Dialogs with popup menus
For the longest time, dialogs in MacPerl could not have popup menus. Well, you could include one, but it wouldn't respond to clicks. If you wanted one, you needed to convert your Dialog into a Window, which means a lot more manual work to handle various things that Dialogs handle for you. So last night I decided to find out why.
I tracked it down to a difference between how the Window and Dialog classes were handling clicks. Window:
FWIW, I am making an über search, so that I can just type in a search term and select a search engine and it'll open my browser to the results, as described in my entry about Google searching.
I tracked it down to a difference between how the Window and Dialog classes were handling clicks. Window:
sub click {Dialog:
my($self, $pt) = @_;
for my $pane (@{$self->{panes}}) {
if ($pane->click($self, $pt)) {
$self->advance_focus($pane);
return 1;
}
};
my($handled);
defined($handled = $self->callhook("click", @_)) and return 1;
}
sub click {Popup menus were appearing via a pane, and the clicks were not being propogated down to the panes. Adding in the missing code to Mac::Dialogs::click(), popup windows now work in dialogs.
my($handled);
defined($handled = $self->callhook("click", @_)) and return 1;
_dialogselect(@_);
}
FWIW, I am making an über search, so that I can just type in a search term and select a search engine and it'll open my browser to the results, as described in my entry about Google searching.
Leave a comment