How to create a module with OCX
that makes the FILL-IN (INT)
move like a lottery. i tried searching the net on how to do it but no luck.
Asked
Active
Viewed 219 times
-3

noob
- 165
- 3
- 18
-
Do you need help with creating an actual OCX? And what does move like a lottery mean? You need to explain this better! – Jensd Dec 16 '15 at 09:04
-
Yes i need help with creating an actual module.. in the module, there are 6 integers that will spin.. then from left to right, it will stop one at a time.. until we get the 6 digit number – noob Dec 16 '15 at 09:21
-
That could be done without using an ocx but regardless of that: on stackoverflow it's customary to show some effort, so: what have you done so far? – Jensd Dec 16 '15 at 09:22
-
Thats the thing. I cant think on how to accomplish the code.. for now, i have just the design.. 6 FILL-INS and a button to get a random 6 digit number. these numbers are equal to the employee-no. – noob Dec 17 '15 at 02:53
1 Answers
1
You are over-complicating it. There is no need for an OCX or multiple fill-ins:
define variable r as integer no-undo.
define variable z as integer no-undo format "999999".
define variable k as integer no-undo.
do k = 6 to 1 by -1:
etime( true ).
do while etime < 1000: /* spend 1000ms on each random digit */
r = random( 0, exp( 10, k ) - 1 ).
display ( z + r ) @ z.
end.
z = z + ( random( 0, 9 ) * exp( 10, k - 1 )).
display z.
/* pause. */ /* handy for debugging... */
end.

Tom Bascom
- 13,405
- 2
- 27
- 33
-
Thanks tom. I also did my own approach.. select a random number to the 1000th time. after selecting the number, i created a procedure to display screen-value on the fill ins to match the selected number. that made my own roulette type fill in.. – noob Dec 18 '15 at 06:39