你好,
我試圖在單選框選擇時產生隨機數,並根據用戶輸入產生一些組合。 到目前為止,這是我唯一擁有的。
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>