Hi,
I am trying to produce random numbers upon radio box selection and produce a number of combination according to user input. So far, this is what I only have.
win = New Window( "LOTTO",
<<MODAL></MODAL>
It is still not clear to me what you want to do but see if this result is close.
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 ) )
)
)
);
);I don't play lotteries so I don't know how to interpret choices like "6/42." Does it mean draw 6 numbers with replacement from 1 to 42?
Anyway, your window as almost complete. Also, you need to check if the user wants to continue. Then use the index obtained from the radio box to proceed. The Choose() function is exactly the right one to use in this case.
Names Default To Here( 1 );
win = New Window( "LOTTO",
<<MODAL></MODAL>