Dialogs with popup menus

pudge on 2002-05-10T12:15:51

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:

sub click { 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; }

Dialog:

sub click { my($handled); defined($handled = $self->callhook("click", @_)) and return 1; _dialogselect(@_); }

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.

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.