Getting livecode to execute a statement contained in a strin
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Getting livecode to execute a statement contained in a strin
Hi,
I have a piece of code that constructs a Livecode statement in a string that I would then like to execute, but I don't know how to do it or if it is possible
My code is as follows:
put "btnContinue" into myBtn
put "Continue to next screen" into myToolTip
put "set the ToolTip of btn " & myBtn & " to " & quote & myToolTip & quote into myCmd
myCmd
I was hoping that "myCmd" would execute the string contents which are:
set the ToolTip of btn btnContinue to "Continue to next screen"
The reason why I would like to do this is to have different tooltips for different buttons set up in an array so that I can change them dynamically depending on the status of the application.
Any assistance would be appreciated
Cheers
bergsy
I have a piece of code that constructs a Livecode statement in a string that I would then like to execute, but I don't know how to do it or if it is possible
My code is as follows:
put "btnContinue" into myBtn
put "Continue to next screen" into myToolTip
put "set the ToolTip of btn " & myBtn & " to " & quote & myToolTip & quote into myCmd
myCmd
I was hoping that "myCmd" would execute the string contents which are:
set the ToolTip of btn btnContinue to "Continue to next screen"
The reason why I would like to do this is to have different tooltips for different buttons set up in an array so that I can change them dynamically depending on the status of the application.
Any assistance would be appreciated
Cheers
bergsy
Re: Getting livecode to execute a statement contained in a s
Figured it out:
do MyCmd
That does the trick
Bergsy
do MyCmd
That does the trick
Bergsy
Re: Getting livecode to execute a statement contained in a s
Hi bergsy,
1. welcome to the forum!
2. In your example script there is no need to DO something:
...
put "btnContinue" into myBtn
put "Continue to next screen" into myToolTip
set the ToolTip of btn myBtn to myToolTip
## Does the trick!
...
Best
Klaus
1. welcome to the forum!

2. In your example script there is no need to DO something:
...
put "btnContinue" into myBtn
put "Continue to next screen" into myToolTip
set the ToolTip of btn myBtn to myToolTip
## Does the trick!
...

Best
Klaus
Re: Getting livecode to execute a statement contained in a s
What Klaus said. No need to "do" what might already be doable.
But you touched on a larger issue. When you simply said "myCmd", this would have worked if you already had a handler by that name. That line is considered by LC as a message to be sent up the hierarchy. Since there was no such handler with that name, you got an error.
So if you are a warrior, you will correct that situation with your original script, and write back with your results. This is a central and powerful technique that you simply must know how to use.
Waiting...
Craig Newman
But you touched on a larger issue. When you simply said "myCmd", this would have worked if you already had a handler by that name. That line is considered by LC as a message to be sent up the hierarchy. Since there was no such handler with that name, you got an error.
So if you are a warrior, you will correct that situation with your original script, and write back with your results. This is a central and powerful technique that you simply must know how to use.
Waiting...
Craig Newman
Re: Getting livecode to execute a statement contained in a s
Craig, Klaus,
Sorry for the late reply. This issue became less of a priority in the last 6 months but will ramp up again soon
Your suggestions are appreciated
Cheers
Greg
Sorry for the late reply. This issue became less of a priority in the last 6 months but will ramp up again soon
Your suggestions are appreciated
Cheers
Greg
Re: Getting livecode to execute a statement contained in a s
Hi Greg,
we didn't hold our breath!
Best
Klaus
we didn't hold our breath!

Best
Klaus