Access TextField val without the window opening

I would like to access the value of a textfield in another window in this case
“SettingsWindow” and text field “CurrentBrowser.Text”

[code] Dim sh As New Shell

sh.Execute(SettingsWindow.CurrentBrowser.Text, “”)
Return True[/code]

when i call the textfield control in the previous code
it opens the “SettingsWindow”
how can i get the value of the textfield without the my “SettingsWindow” opening.

thx

you must unchek the “implicit instance” on the window property
you must uncheck the “visible” property of the window

then in your code, dim w as new mywindow
the window is available, you can set/get the textfields in the window you want
when finished, call w.show and the window will appear.

@David Cullins
It’s a very bad idea to delete the first post!

[quote=317866:@David Cullins]I would like to access the value of a textfield in another window in this case
“SettingsWindow” and text field “CurrentBrowser.Text”[/quote]

A better way would be to store the content of the TextField in a property accessible from the other windows.

Something such as App.CurrentBrowser.

You can do that in the TextChange event of the TextField, so it stays current.

Coming from a long-lived procedural, top-down C programming world, this is a lesson I learned the hard way as well. It truly is something that you should make part of your design planning as it will make a big difference in the way you look at writing code in an object-oriented environment.

ok thank you all…

Micheal,

One question…
Is it more effient to use double assignments
ex: textfield and app.var
or
would it be more efficient to set up a tab control so every control can be within one window. ? and how would add a “tab control” to an existing project where all the
existing controls in a window would fall into “tab0” the first tab…

please advise.

That’s totally dependent on what you’re trying to achieve with your app, but the property assignment is most often the best solution in an OOP language like Xojo.

[quote=317959:@David Cullins]Micheal,

One question…
Is it more effient to use double assignments
ex: textfield and app.var
or
would it be more efficient to set up a tab control so every control can be within one window. ? and how would add a “tab control” to an existing project where all the
existing controls in a window would fall into “tab0” the first tab…
[/quote]

Using a common variable for two windows is the way, if you need it in two places.