你好,
我试图在单选框选择时产生随机数,并根据用户输入产生一些组合。 到目前为止,这是我唯一拥有的。
win = New Window( "LOTTO",
<<MODAL></MODAL>
我仍然不清楚你想做什么,但看看这个结果是否接近。
Names Default To Here( 1 );
win = New Window( "LOTTO", << Modal,
Panel Box( "Select one",
rb = Radio Box( {"6/42", "6/45", "6/49", "6/55", "6/58"} ),
H List Box(
Text Box( "Enter Number of Combinations" ),
textbox_value = Number Edit Box( 1 )
)
),
H List Box(
Button Box( "OK",
rb_result = rb << Get;
random = textbox_value << Get;
),
Button Box( "Cancel" )
)
);
If( win["Button"] == -1,
Throw( "User cancelled" )
);
dt = New Table( "Lotto" );
For( c = 1, c <= random, c++,
dt << New Column( "Draw " || Char( c ),
"Numeric",
"Continuous",
Values(
Choose( rb_result,
J( 6, 1, Random Integer( 1, 42 ) ),
J( 6, 1, Random Integer( 1, 45 ) ),
J( 6, 1, Random Integer( 1, 49 ) ),
J( 6, 1, Random Integer( 1, 55 ) ),
J( 6, 1, Random Integer( 1, 58 ) )
)
)
);
);我不玩彩票,所以我不知道如何解释像“6/42”这样的选择。 这是否意味着从1到42替换6个数字?
无论如何,你的窗口几乎完成了。 此外,您需要检查用户是否要继续。 然后使用从单选框获得的索引继续。 在这种情况下,Choose() 函数正是使用的正确函数。
Names Default To Here( 1 );
win = New Window( "LOTTO",
<<MODAL></MODAL>