I’m trying to build an app where, to start with, I’d like to build a Preferences Window that opens when I select “Preferences” from the menu bar.
I’m looking for a nice multi window example.
Should I be making a seperate NIB file for each window or just adding windows to the main nib? In either case, how do I actually open the windows? I’ve tried “open window” and setting the window to visible but both result in error, so I guess I’m not connecting the extra windows correctly.
I know how to connect the window contents up to my script, I just can’t get the darn things to open up.
I seem to do all kinds of things with one window, its been great. I’d like to get out of the shallow end of the pool though.
Am I able to pass the result of opeing a window and its operations to a variable.
on mouse up theObject event theEvent
if the name of theObject is "ChooseSource" then
set string value of text field "source" of window "Preferences" to findFolder()
end if
if the name of theObject is "ChooseTarget" then
set string value of text field "target" of window "Preferences" to findFolder()
end if
if the name of theObject is "browserSelectButton" then
return "theSelectedObject"
end if
if the name of theObject is "browserCancelButton" then
hide window "browser"
end if
end mouse up
on findFolder()
show window "browserWindow"
(* how do I make this function return the value *)
return "???"
end findFolder
Well what do you know. Open panel is exactly what I needed. I was doing it the hard way. Thanks for that.
I’m still curious, in a more general since, whether or not you can set a function to return the result of a set of window operations. This may be thinking too much along the lines of a web application where information is comming from a get or post operation. But I can imagine someone may want a function which opens a window and returns the submitted information into a variable.
What is being submitted? Keep reading, then ask questions if you’d like more information.
You can display dialog in either the standard way or attached to a window, and you can also display a window/panel attached to another window (if you need more choices). Information on all of this can be found on that same page that I linked to above; It describes the Panel Suite.