Panel things in Xcode


(Andreas Kiel) #1

Probably this is another stupid question, but there so many things new, different and whatever while I’m trying to convert/merge my old ASS apps and replacing Satimage at a time.
In the old ASS days I could write:

set res to display panel window “somePanel”

and a “panel script” (which was valid for several panels)

on clicked theObject
set objName to name of theObject
if objName = “cancel” then
close panel window of theObject with result 0
else if objName = “okay” then
close panel window of theObject with result 1

else if objName = “newSettings” then
close panel window of theObject with result x
end if
end clicked

How to achieve with ASobjC in Xcode now?


(Shane Stanley) #2

I think what you’re after is showing a window as a sheet.


(Andreas Kiel) #3

No, not a sheet (attached).

More like an alert.
An example: Lets say I have some code running collecting some values. At a certain state a panel window should be displayed - the code execution is “put on hold”.
Like with an alert there are some buttons, unlike with the alert there could be popups or lists, checkboxes.

example

After that the code should proceed with the selected value(s).


(Shane Stanley) #4

That’s either an NSPanel or NSWindow, depending on what layer you want it to appear on, shown modally, using NSApplication’s runModalForWindow:. You end the display by calling stopModalWithCode: or abortModal within the window’s buttons’ action handlers.


(Andreas Kiel) #5

Many thanks Shane,

You made my day!