Jump to content

Window Specific Variable


This topic is 5351 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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" " & "; "" )" ) ]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 5351 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.