Help with cancel button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 25
- Joined: Mon Oct 18, 2010 6:32 pm
Help with cancel button
Hi,
I'm currently using the new LiveCode environment on evaluation after a successful
spell with RevMedia.
I am using it for education purposes and have developed a simple guess the number
game using a repeat until users guess = the number the computer has selected.
I have pup "Please enter the numbr the computer is thinking" in a PUT statement
and the numbers guessed being put into an output field. One problem that I see
exists on both RevMedia and LiveCode however is the "cancel" button.
It doesn't seem to work. If I want to exit the game, through the cancel button,
does this need to be scripted also? If so, how do I go about doing that.
Many thanks,
Steven Whyte
Here is my code:
I'm currently using the new LiveCode environment on evaluation after a successful
spell with RevMedia.
I am using it for education purposes and have developed a simple guess the number
game using a repeat until users guess = the number the computer has selected.
I have pup "Please enter the numbr the computer is thinking" in a PUT statement
and the numbers guessed being put into an output field. One problem that I see
exists on both RevMedia and LiveCode however is the "cancel" button.
It doesn't seem to work. If I want to exit the game, through the cancel button,
does this need to be scripted also? If so, how do I go about doing that.
Many thanks,
Steven Whyte
Here is my code:
- Attachments
-
- Screen shot 2010-10-18 at 18.36.30.png (116.08 KiB) Viewed 5433 times
Re: Help with cancel button
Hi Steve,
you should check for "Cancel" immediately after every ASK (and ANSWER) dialog like this:
...
ask "Please enter your guess..."
if the result = "Cancel " then
exit to top
end if
...
Best
Klaus
P.S.
Please post your code next time (no screenshot) so it it easier to copy/paste parts of it if necessary
you should check for "Cancel" immediately after every ASK (and ANSWER) dialog like this:
...
ask "Please enter your guess..."
if the result = "Cancel " then
exit to top
end if
...
Best
Klaus
P.S.
Please post your code next time (no screenshot) so it it easier to copy/paste parts of it if necessary

-
- Posts: 25
- Joined: Mon Oct 18, 2010 6:32 pm
Re: Help with cancel button
Thank you so much Klaus!
Works perfectly
Works perfectly

Re: Help with cancel button
Oh!!!Klaus wrote: you should check for "Cancel" immediately after every ASK (and ANSWER) dialog like this:
...
ask "Please enter your guess..."
if the result = "Cancel " then
exit to top
end if
Take care of the "Cancel" first, then attend to the rest of it!
Wow, that would have saved me some trouble.
I'm going to have to begin a list of scripting "best practices."
2nd-grade Teacher, Poultry Fancier, Scottish Country Dancer
and Perpetual Beginner
and Perpetual Beginner
-
- Posts: 25
- Joined: Mon Oct 18, 2010 6:32 pm
Re: Help with cancel button
I'm having one further problem with the above program. It should be the last! It appears simple but I can't find the suitable property to select in the inspector.
The problem is with the output field. I have set up two of these as shown in the Interface screenshot below. When I input a number, it will add it to the bottom of the list and the pop up box will prevents me from using the scroll bars.
Is there a way that the users guess and decision could be visible and the user has to scroll up to see the list of wrong guesses rather than any new guesses being hidden at the bottom of the list? So in other words, all new guesses are shown as the scroll list gets bigger and then at the end of the game once the pop up box disappears, the user can scroll up to see their wrong guesses.
I've also shown the properties for one of the output boxes, hopefully it is just as simple as selecting one of them but i've tried lots of different combinations with no avail.
Cheers,
Steven
The problem is with the output field. I have set up two of these as shown in the Interface screenshot below. When I input a number, it will add it to the bottom of the list and the pop up box will prevents me from using the scroll bars.
Is there a way that the users guess and decision could be visible and the user has to scroll up to see the list of wrong guesses rather than any new guesses being hidden at the bottom of the list? So in other words, all new guesses are shown as the scroll list gets bigger and then at the end of the game once the pop up box disappears, the user can scroll up to see their wrong guesses.
I've also shown the properties for one of the output boxes, hopefully it is just as simple as selecting one of them but i've tried lots of different combinations with no avail.
Cheers,
Steven
- Attachments
-
- Properties for Output Decision text box
- Screen shot 2.jpg (128.52 KiB) Viewed 5399 times
-
- User Interface for the High, Low, Spot On program
- Screen shot 2010-10-19 at 10.46.51.jpg (157.7 KiB) Viewed 5399 times
Re: Help with cancel button
Hi Steve,
I am not sure I understand your problem, but I guess you want to appear the LAST guesses at the TOP of the fields instead at the end?
So they are always visible?
Then do not count the guesses, but instead put the last guess and a CR BEFORE the appropriate fields!
No need to "count" the lines with "which"!
Know what I mean?
Well, I hope that is what you mean
Best
Klaus
I am not sure I understand your problem, but I guess you want to appear the LAST guesses at the TOP of the fields instead at the end?
So they are always visible?
Then do not count the guesses, but instead put the last guess and a CR BEFORE the appropriate fields!
No need to "count" the lines with "which"!
Code: Select all
...
repeat until guess = ....
answer ...
...
put it into check_number
validate
put guess & CR BEFORE fld "outputnumber"
if guess > mynumber then
put "Too low" & CR BEFORE fld "outputdecision"
end if
## etc...
end repeat
...
Well, I hope that is what you mean

Best
Klaus
-
- Posts: 25
- Joined: Mon Oct 18, 2010 6:32 pm
Re: Help with cancel button
Hi Klaus,
Spot on again! Thank you very much!
Steven
Spot on again! Thank you very much!

Steven