On Aug 20, 2004, at 3:31 PM, Alan Olsen wrote:

I am opening it as a modal dialog box. What I am trying to do is get it to act like "OpenPanel" or the alert dialog. Those return to the calling process when they are done and not before.

That *is* how a modal session acts. For example, let's assume a panel that's connected to the outlet named MyPanel. In that panel you have a table view named TableView. In some action method, you open the panel like this:


my $row = NSApplication->sharedApplication()->runModalForWindow($self- >myPanel());

The call to runModalForWindow: won't return until the modal session is stopped with stopModal, stopModalWithCode:, or abortModal. Let's assume you want it to return the selected row in TableView. In the action handler for the OK button, you'd have something like this:

sub okClicked : Selector(okClicked:) ArgTypes(@) ReturnType(v) {
        my ($self, $sender) = @_;
        my $rowSel = $self->tableView()->selectedRow();
        NSApplication->sharedApplication()->stopModalWithCode($rowSel);
}

If you need to do something more complex, like return a string or object, just store it in an instance variable and use stopModal instead of returning it directly with stopModalWithCode.

I have tried waiting in a loop until a message comes back, but that gives me the technicolor pizza.

Like I said, that's by design. If you're spinning in a tight loop, you're not responding to events, and that means pizza.


sherm--



Reply via email to