Hi everyone, I have three questions,
-
If I have multiple panels, an ‘Open Panel’ and one created in IB, how am I going to filter them in my handler? I know how to do it like "if name of theObject = “whatever” then but how am about doing that with panels ? (and especially Open Panels?) do I need to filter it like : “on panel ended theObject with result withResult” but then with a different variable as result ?
-
If I have an Open Panel, can I force the user to select a file before he/she can click the button that performs the action ? (the not Cancel one)
-
If one selects a file/folder, my application processes a code, while processing, the open panel keeps open… Can I somehow close the panel and then perform the actions?
Thanks for any help 
Hi,
here’s some direction, not necessarily the complete answer.
1- open / save panels are different from user-created panels. you don’t have to worry about open/save panels. just use it. Look in the example files for Save Panel project and Display Panel project. These will show you how to have a separate panel nib, and attach that to the script.
2- I don’t think you can press OK/Open if there is no file selection. ? You can restrict an open dialog to only folders or only files, or hide invisible files, etc.
3- I am not sure what you mean with this question. If you make a panel, you must specify in the code to not do anything until the panel closes. I believe you are right in point 1 with “on panel ended” not just “display panel”. Using one method will continue your script, and the other will stop until the panel is closed by the user pressing a button. If you are making a panel yourself to use as an open panel, you’re doing something wrong.
This was just from the top of my head I haven’t rechecked any code.
If you don’t explicitly close the panel yourself then the panel won’t actually close until the end of the “panel ended” handler. As such you just close the panel yourself before you execute any code. Here’s an example of how to do this for both an open panel and one you’ve created yourself.
on panel ended theObject with result withResult
if (theObject is open panel) and (withResult is 1) then
close panel open panel
-- do your stuff here
else if name of theObject is "whatever" then
close panel theObject
-- do your stuff here
end if
end panel ended
Thanks a lot, now everything works like I wanted it
I really appreciate it.