However, as the user of this stack (my wife) has requested some enhancements, I decided the user interface was getting somewhat unwieldy with all the buttons that had to be disabled, enabled, and renamed in order to prevent errant clicks while an operation was taking place and needed to be completed before any other operation was started. In other words: I was "faking" a modal dialog by messing about with many other UI elements. That's bad scripting on my part.
I'm cleaning it all up now but found an issue with referencing objects that appears strange to me (not the objects but the referencing). This arose only when I started using the "sheet stack" command. [Edit: I deleted "modal" and substituted "sheet".] My scripts referencing objects in the main stack now require that I identify the stack. As an example, I used to write:
Code: Select all
put theVar into line x of field y
Code: Select all
put theVar into line x of field y of stack mainStackName
Code: Select all
set the icon of button "sortListbyAmount" to 0
Code: Select all
set the icon of button "sortListbyAmount" of stack "mainStackName" to 0
So three questions:
1. Does the fact that the substack is closed have no relevance as we're still executing code that's being called from that substack? (It appears that way from the observed behavior.)
2. Am I in error thinking there's a one line command I may use to eliminate the need for the complete object reference (ie, including the stack name in each line of code that refers to an object in that main stack)?
3. Or should I re-write my code so that when the modal substack is closed, I just pass the variable to the next line in the button that opened the substack in the first place? I'm thinking:
Code: Select all
on mouseUp
global myVar -- gets filled in the modal stack called in next line
modal stack "myDialog"
-- now myVar is filled in the modal stack
put myVar into line x of field y -- do I no longer need "of stack mainStackName"??
theTotal -- script in stack mainStackName
end mouseUp
As always, suggestions are welcome and appreciated.
Barry