Question: User interface

Hi, all. I need to built a user interface for my program. First, I create two label and two text area for both the value of x and y. After that I assign a button to random generate the value for x and y within the range with x <y. I write the code below into click action of the button.

use DocumentTools in

Do(%x=RandomTools[Generate](integer(range=1..7);

Do(%y=RandomTools[Generate](integer(range=1..7);

while %x>= %y do

Do(%x=RandomTools[Generate](integer(range=1..7);

Do(%y=RandomTools[Generate](integer(range=1..7);

end do;

end use;

This code can generate two random number and insert inside the boxes created. When the button is clicked, two random number generated but the error dialog box shown on the screen with message : Error in component button with caption "generate" cannot determine if this expression is true or false: %y=%x. What I want is only the true value of x<y will be inserted to the text boxes. 

Any suggestion? Any help will be highly appreciated. Thank you.

 

Please Wait...