I have a variable which the user can change in a
drop-down list. A change of this variable will
trigger a re-calculation of data.
Can I have code which will start this re-calculation
when the user changes the variable (after a suitable
warning)?
I could use an ask dialogue if I could attach code to
one of the buttons (i.e "OK") else would need the
user to click another button. Would work but not
so "elegant" I feel.
While on the subject of the "ask" dialogue window
is there any way to change the size (in Win) or any
of the other parameters of said window?
I see elsewhere that the "ask" function is regarded
as being out-of-date. What's the best alternative?
Recalculate on variable change
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Recalculate on variable change
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
-
- VIP Livecode Opensource Backer
- Posts: 9648
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Recalculate on variable change
Any clever and fun choosing method will do. A drop down menu that magically appears when you click on the "Press Me" button? A scrolling list field?
Since you are changing a variable from the outside, may I assume this is a global?
In any case. Once you have your selection, you (pseudo)
Or is any of this related to your problem?
Craig Newman
Since you are changing a variable from the outside, may I assume this is a global?
In any case. Once you have your selection, you (pseudo)
Code: Select all
global gVar
on menuPick pItemName
put pItemName into gVar --if a pull down or similar button
---------
put the selectedText into gVar --for a list field, say
---------
doWhatEverElseMightBeAppropriateForTheMethodYouChose --for whatever
Craig Newman
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Recalculate on variable change
Here's a thought:
on menuPick chooseNum
put chooseNum into CHNUM
answer "Do you want to recalculate with the new number?" with "Yes" and "No"
if it is "Yes" then
put ((CHNUM * 3) + 27) into fld "xyz"
end if
end menuPick
Needless to say, if you want the menuPick to access a script outwith itself you will
need to put the chosen number into a global you have previously declared, and then
where my script has "put ((CHNUM * 3) + 27) into fld "xyz" " you will have to have something
like:
send "mouseUp" to button "Do It Baby"
on menuPick chooseNum
put chooseNum into CHNUM
answer "Do you want to recalculate with the new number?" with "Yes" and "No"
if it is "Yes" then
put ((CHNUM * 3) + 27) into fld "xyz"
end if
end menuPick
Needless to say, if you want the menuPick to access a script outwith itself you will
need to put the chosen number into a global you have previously declared, and then
where my script has "put ((CHNUM * 3) + 27) into fld "xyz" " you will have to have something
like:
send "mouseUp" to button "Do It Baby"