Hi! How to make buttons on ANSWER work? see 5th post
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Hi! How to make buttons on ANSWER work? see 5th post
Hi, all!
I am developing a Bulls & Cows game on mobile for fun as practice.
I have two questions, and I can't find the answers in either the dictionary or tutorials.
1.
For example,
answer "Sorry! Game Over!" with "Start a new game" or "Give me a second"
How can I make LiveCode run commands when user chooses one specific button in dialog?
2.
I have a "option" button, when user clicks a button, I want the label of that option button becomes empty or null.(just make it shown as blank)
How can I achieve that?
thanks,
Michael
I am developing a Bulls & Cows game on mobile for fun as practice.
I have two questions, and I can't find the answers in either the dictionary or tutorials.
1.
For example,
answer "Sorry! Game Over!" with "Start a new game" or "Give me a second"
How can I make LiveCode run commands when user chooses one specific button in dialog?
2.
I have a "option" button, when user clicks a button, I want the label of that option button becomes empty or null.(just make it shown as blank)
How can I achieve that?
thanks,
Michael
Last edited by ECNU4271 on Fri Sep 20, 2013 1:15 am, edited 1 time in total.
Re: Hi! How to make buttons on ANSWER work?
Hi.
When you read the entry in the dictionary, you may have seen that the choice you made from the dialog was placed automatically into the local variable "it".
This information can be used (and I recommend using it right away) to drive one or more routines. So:
Note that the "cancel" option was not handled. Do you see why it need not be?
Can you rewrite the above with a "switch" construction?
EDIT:
As for the option button, you can:
Initially, you have to set both. Once you set both to empty, the button will show nothing. You will have to fix that by hand if you want to revert.
Craig
Craig Newman
When you read the entry in the dictionary, you may have seen that the choice you made from the dialog was placed automatically into the local variable "it".
This information can be used (and I recommend using it right away) to drive one or more routines. So:
Code: Select all
answer "Read the Dictionary Again" with "OK" or "Nuts to you" or "Cancel"
if it = "OK" then doUsefulStuff
else if it = "Nuts to you" then destroyComputer
Can you rewrite the above with a "switch" construction?
EDIT:
As for the option button, you can:
Code: Select all
on menuPick pItemName
switch pItemName
case "choice 1"
set the name of me to ""
set the label of me to ""
end switch
end menuPick
Craig
Craig Newman
Last edited by dunbarx on Thu Sep 19, 2013 10:39 pm, edited 1 time in total.
Re: Hi! How to make buttons on ANSWER work?
dunbarx wrote:Hi.
When you read the entry in the dictionary, you may have seen that the choice you made from the dialog was placed automatically into the local variable "it".
This information can be used (and I recommend using it right away) to drive one or more routines. So:
Note that the "cancel" option was not handled. Do you see why it need not be?Code: Select all
answer "Read the Dictionary Again" with "OK" or "Nuts to you" or "Cancel" if it = "OK" then doUsefulStuff else if it = "Nuts to you" then destroyComputer
Can you rewrite the above with a "switch" construction?
Craig Newman
Hi, Craig, Cancel indicates to make the dialog go away. The default setting of the button is so.
Sorry I don't know how to use switch...
Thanks for the help,
Michael
Re: Hi! How to make buttons on ANSWER work?
Hi.
Our posts crossed in the mail. Check back a couple...
Dialogs are modal, which means they must be dismissed before you can do anything else in the program. The selection of any of the options will dismiss the dialog, it just is a matter of what else might happen when you do. So if instead of "cancel" you had written "eject programmer", and did not set aside anything to handle that choice, the dialog is still dismissed.
The default setting is up to you, and is really just a convenience provided by the engine.
The "switch" control structure is worth playing with. It trumps complex if/then constructs, and is no harder to learn. You need both. Experiment. Write back soon with this rewrite.
Craig
Our posts crossed in the mail. Check back a couple...
Dialogs are modal, which means they must be dismissed before you can do anything else in the program. The selection of any of the options will dismiss the dialog, it just is a matter of what else might happen when you do. So if instead of "cancel" you had written "eject programmer", and did not set aside anything to handle that choice, the dialog is still dismissed.
The default setting is up to you, and is really just a convenience provided by the engine.
The "switch" control structure is worth playing with. It trumps complex if/then constructs, and is no harder to learn. You need both. Experiment. Write back soon with this rewrite.
Craig
Re: Hi! How to make buttons on ANSWER work?
I've finished my app and try running in iOS simulator.
However, the fail suggestion on starting the iOS simulator is " Unable to start simulation: Unknown error".
I really don't know why this happens.
The standalone setting is exactly the same as my previous app which still runs very well in the simulator now.
The provisional profile is OK as well.
The screen size is OK.
Do you know why the problem occurred?
The error information from LC should be more specific anyway....
The mistake seems to happen when the iOS simulator tries to load the app and run. It got stuck and pops out the error.
Thanks!!
Michael
However, the fail suggestion on starting the iOS simulator is " Unable to start simulation: Unknown error".
I really don't know why this happens.
The standalone setting is exactly the same as my previous app which still runs very well in the simulator now.
The provisional profile is OK as well.
The screen size is OK.
Do you know why the problem occurred?
The error information from LC should be more specific anyway....
The mistake seems to happen when the iOS simulator tries to load the app and run. It got stuck and pops out the error.
Thanks!!
Michael
Last edited by ECNU4271 on Fri Sep 20, 2013 4:10 pm, edited 1 time in total.
Re: Hi! How to make buttons on ANSWER work?
Really don't know why, can anybody help me?
Can't make it run in the simulator & move it into my iPhone via Xcode
Can't make it run in the simulator & move it into my iPhone via Xcode
Re: Hi! How to make buttons on ANSWER work? see 5th post
any hint or clue why this happens?
I've thought about this whole night, still don't understand.
When I put the card of app "don't work" into app "work well", it worked in the simulator.
In the mean time, the provisional profile is right, the standalone setting is the same.
I really don't know why the problem exists
I've thought about this whole night, still don't understand.
When I put the card of app "don't work" into app "work well", it worked in the simulator.
In the mean time, the provisional profile is right, the standalone setting is the same.
I really don't know why the problem exists
Re: Hi! How to make buttons on ANSWER work? see 5th post
OK I got it.
Simply because the display name can not include "&".

Simply because the display name can not include "&".



