Michael Reade Posted August 3, 2009 Posted August 3, 2009 I'd like to have a variable that is specific to a window. A global variable or a global window is not exactly I want, as I may have more than one window (of the same type) open at the same time, each one showing a different set of records (pertaining to THAT window variable). Any suggestions? Thanks, Michael
TheTominator Posted August 3, 2009 Posted August 3, 2009 You might try creating global script variables that are keyed to different windows by a naming convention. (This requires that you make sure that no two windows have the same name.) If you have two windows named "Contacts" and "Phone Numbers" you could have two global variables named $$specialVar_Contacts $$specialVar_PhoneNumbers Clever use of Execute() along with text filtering and substitute functions can allow you to read and assign to these variables programmatically from the window name. This could be useful if you don't want to have a lot of If/ElseIf statements in your script.
mr_vodka Posted August 3, 2009 Posted August 3, 2009 As part of your new windows action, you may be able to set the variable name as the window name using the evaluate. Something like: Set Variable [ $setvar; Evaluate ( "Let ( $$" & TrimAll ( Get ( WindowName );1 ;3 ) & "="SomeText" " & "; "" )" ) ]
TheTominator Posted August 3, 2009 Posted August 3, 2009 Yes indeed. I do mean Evaluate(). Thank you for catching that.
comment Posted August 3, 2009 Posted August 3, 2009 I think I would prefer something simpler, even if less generic - otherwise you'll be evaluating all day long (since the variable's name is unknown in advance, you'll need Evaluate() to retrieve the stored value, too). Of course, if the windows are opened and named by script, this would be trivial. Otherwise, you could use the window's name suffix as the variable's repetition.
TheTominator Posted August 3, 2009 Posted August 3, 2009 This is an example file of creating a unique window name via a script and assigning to a uniquely named global (from the window name). There are two concerns dealt with. (1) Making sure window name is unique. (2) Making sure variable filename is valid by sanitizing the window name and that uniqueness is still preserved after modifying the name. The calc for converting a window name to the global variable name can be made into a custom function for ease of use, but I didn't do that here to broaden the compatibility. OneGlobalPerWindow_fp7.zip
Michael Reade Posted August 4, 2009 Author Posted August 4, 2009 Thanks for everyone input and help. I was considering using the window name as the variable. What I am trying to do is have 8 different layouts (4 list, 4 detail) display 4 different kind of job_items. So as the user clicks on a different tab, he/she will see the different kinds of job_items for that job, depending on which layout he/she is in. It can easily be done using the window title. I was just wondering if anyone has a better suggestion. Thanks a lot, Michael
Recommended Posts
This topic is 5590 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now