On 4 Aug 2007, at 06:23, Allan Odgaard wrote:
On 3. Aug 2007, at 13:32, Hans-Joerg Bibiko wrote:
[...] I wonder if it would be possible to write a nib which contains a button, e.g. 'Browse', and if I press this button it opens an other nib (or in that case a file select dialog). The returned value from the called nib (file select) will set a value in the first nib?
That should be possible.
If you open a nib asynchronously (-a) and bind a button action to returnArgument: or connect it to performButtonClick: then the button will make "$DIALOG" -w«token» return, but will not close the window or anything (using performButtonClick: you will get the label + tag for the button clicked in the resulting plist).
Simple example: I bound two buttons to performButtonClick: (in FirstResponder) and one button (Cancel) to performClose: (in NSWindow or NSPanel). If I invoke the nib via
"$DIALOG" -m the_nib
everything works fine. The result is e.g.: <dict> <key>returnButton</key> <string>Button1</string> <key>returnCode</key> <integer>1</integer> </dict> or <dict> <key>returnButton</key> <string>Button2</string> <key>returnCode</key> <integer>2</integer> </dict> If I invoke it via
"$DIALOG" -a the_nib
the dialog appears. Then I call (my token is 3)
"$DIALOG" -w 3
the dialog/TM hangs. The dialog (a panel) doesn't accept any event. I only can press APPLE+. to cancel. As a window it returns (async) Window 3: error 1
My goal is that if I press Button1 to call function1 and if I press Button2 to call Function2. If I press the Cancel button to call "$DIALOG" -x $mytoken.
What am I doing wrong?
Any hints?
Hans