View Full Version : Variable Persistence
NitLions
03-22-2007, 01:02 PM
If I set a variable mydir = Dialog.FolderBrowse("Please select a folder:", "C:\\"), will mydir be usable from another button. Does it hold its value and, if so, when is it cleared.
Any info APPRECIATED!
If I set a variable mydir = Dialog.FolderBrowse("Please select a folder:", "C:\\"), will mydir be usable from another button. Does it hold its value and, if so, when is it cleared.
Any info APPRECIATED!
If you declare the variable as local as in:
local mydir = Dialog.FolderBrowse("Please select a folder:", "C:\\")
then the variable is only held within the event or function it is declared in.
If you don't use "local" then the variable is global to the project and can be used anywhere within.
NitLions
03-22-2007, 01:51 PM
On a page OnShow script, I'm searching for a registry key.
Then on a button click script (same page), if this registry key that holds a previous installation directory is not found, I want to present a folder browse dialog.
The part I'm hitting a snag on is determining the value of avdir to decide whether to presend the browse dialog or not.
I currently have
if avdir == nil then
present dialog to set avdir
end
It doesn't appear to be working as I've rigged the key in the registry for testing, but it isn't grabbing it for some reason.
I'd have to see how you're setting "avdir" to be able to help
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.