Scope within controls
pokeeffe
If the user presses button A ["Select file(s)"], the button action procedure calls Open and populates a Listbox with each of the file names returned. I don't have to reference S_fileName as an SVAR in this case. Everything works just fine.
If the user presses button B ["Search in directory..."], the action procedure launches another panel designed to search for files within directories, then calls PauseForUser to wait for the new panel to close. This new panel creates a global string S_fileName when it is closed, however, this global variable is not accessible to the original panel. Attempting to reference it as when using Open results in null string errors. Inserting an SVAR reference statement immediately after the PauseForUser statement results in a mismatched global variable reference type.
Does anyone understand why my references to S_fileName via button B do not work? And what should I change to get a proper reference?
So the S_fileName coming from Open isn't really a global variable. I'll need to find a different way to access the S_fileName produced from my file searching panel. Or change the variable name and go with the global route. I'll probably explore using pass-by-reference instead.
October 26, 2011 at 02:05 pm - Permalink
string newfilename = ""
NewPane/n=firstpanel/...
...
if (V_flag)
newfilename = OpenPanelTwo()
if (strlen(newfilename)==0)
return 0
end
end
return 0
end
Function/S OpenPanelTwo()
NewPanel/N=secondpanel/...
...
Open/...
PauseForUser
...
KillWindow ...
return S_filename
end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
October 28, 2011 at 07:56 am - Permalink