answer text as constant and the quotation marks?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
answer text as constant and the quotation marks?
New to coding and to LiveCode. Have the text for answer box that is used in many places and trying to use a constant placed in card script to hold the appropriate text.
The statement directly placed in a button script works.
answer "Current activity being timed - Finish timing and start new activity or cancel new one" with "Finish" or "Cancel"
I would like to be able to put in the button script
answer value(ActivityTimingInProcess)
and in maincard script define a constant
constant ActivityTimingInProcess="Current activity being timed - Finish timing and start new activity or cancel new one" with "Cancel" or "Finish"
This does not work but following without buttons texts does.
constant ActivityTimingInProcess="Current activity being timed - Finish timing and start new activity or cancel new one"
I am having trouble with the various extra sets of quotation marks for buttons. Have tried double sets in various places and single+double around the cancel etc.. Have run out of ideas. This is simple issue but if anybody could help or say it is not possibile then would be grateful. Di I need to be doing soem construction with &&?
Thanks
Paul
Paul
The statement directly placed in a button script works.
answer "Current activity being timed - Finish timing and start new activity or cancel new one" with "Finish" or "Cancel"
I would like to be able to put in the button script
answer value(ActivityTimingInProcess)
and in maincard script define a constant
constant ActivityTimingInProcess="Current activity being timed - Finish timing and start new activity or cancel new one" with "Cancel" or "Finish"
This does not work but following without buttons texts does.
constant ActivityTimingInProcess="Current activity being timed - Finish timing and start new activity or cancel new one"
I am having trouble with the various extra sets of quotation marks for buttons. Have tried double sets in various places and single+double around the cancel etc.. Have run out of ideas. This is simple issue but if anybody could help or say it is not possibile then would be grateful. Di I need to be doing soem construction with &&?
Thanks
Paul
Paul
Re: answer text as constant and the quotation marks?
Hi Paul,
1. welcome to the forum!
2. Declar a constant at the top of your stack script:
Then, on any card you can:
Hope that helps!
Best
Klaus
1. welcome to the forum!

2. Declar a constant at the top of your stack script:
Code: Select all
constant ActivityTimingInProcess= "Current activity being timed - Finish timing and start new activity or cancel new one"
on openstack
###
end openstack
## Then create a handler for this, so you can execute this everywhere in your stack!
function answer_the_contant
answer ActivityTimingInProcess with "Cancel" OR "New"
return it
end answer_the_contant
Code: Select all
on mouseup
put answer_the_contant() into what_the_user_answered
if what_the_user_answered = "cancel" OR what_the_user_answered = EMPTY then
exit mouseup
end if
## user selected NEW, act accordingly here:
## :-)
end mouseup
Best
Klaus
Re: answer text as constant and the quotation marks?
Klaus
Very Helpful thank you - will try that.
thanks
Paul
Very Helpful thank you - will try that.
thanks
Paul
Re: answer text as constant and the quotation marks?
Klaus
All works fine. It has also helped me understand approaches. All my 9 buttons behave when clicked except they put their own label into field CurrentActivity. I have been unable to access the label property of the button except from with the button scrip itself using put the label of me into field "CurrentActivity" . Apart from this I could put the whole button script in one place handler in the card script and then reference it in each button with one call. My problem is the label of me is interpreted at the card level as the label of the card not the button clicked. Do you know if it is possible to have it detect the label of the button that was clicked generically from a card script?
Understand if you are too busy to reply to another question not original topic. Feel making progress in my first day of coding!
thanks
Paul
Button Script currently
on mouseUp
if field "CurrentActivity" is empty then
put the label of me into field "CurrentActivity"
StartActivityTiming
else
put answer_the_constant() into user_response
if user_response="Cancel" OR user_response=EMPTY then
exit mouseUp
end if
EndActivityTiming
put the label of me into field "CurrentActivity"
StartActivityTiming
end if
end mouseUp
All works fine. It has also helped me understand approaches. All my 9 buttons behave when clicked except they put their own label into field CurrentActivity. I have been unable to access the label property of the button except from with the button scrip itself using put the label of me into field "CurrentActivity" . Apart from this I could put the whole button script in one place handler in the card script and then reference it in each button with one call. My problem is the label of me is interpreted at the card level as the label of the card not the button clicked. Do you know if it is possible to have it detect the label of the button that was clicked generically from a card script?
Understand if you are too busy to reply to another question not original topic. Feel making progress in my first day of coding!
thanks
Paul
Button Script currently
on mouseUp
if field "CurrentActivity" is empty then
put the label of me into field "CurrentActivity"
StartActivityTiming
else
put answer_the_constant() into user_response
if user_response="Cancel" OR user_response=EMPTY then
exit mouseUp
end if
EndActivityTiming
put the label of me into field "CurrentActivity"
StartActivityTiming
end if
end mouseUp
Re: answer text as constant and the quotation marks?
Hi Paul,
well, I live here, so no other important things to do!
Card script:
Button script(s)
I think this will fit your needs
Best
Klaus
well, I live here, so no other important things to do!

Very good!Apart from this I could put the whole button script in one place handler in the card script and then reference it in each button with one call.
Just pass a parameter to the call -> the label of the button clicked!My problem is the label of me is interpreted at the card level as the label of the card not the button clicked
Card script:
Code: Select all
command cardLevelMouseup tLabel
## do your "generic"stuff with tLabel here!
...
put tLabel into field "CurrentActivity"
...
end cardLevelMouseup
Code: Select all
on mouseup
## Let the button pass its LABEL
cardLevelMouseup the label of me
end mouseup

Best
Klaus
Re: answer text as constant and the quotation marks?
Brilliant. I am still coming to terms with the much looser natural language e.g label of me. Had not thought of the parameters idea - measure of my inexperience.
Thanks
Thanks