Drop down menus

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Drop down menus

Peter Simmonds
How can I create a dropdown menu? I can do the View Composer stuff and
create the button ok but I can find no way of creating the actual menu nor
how to connect it to the button.

Can anyone help?

Peter Simmonds
Northampton, UK


Reply | Threaded
Open this post in threaded view
|

Re: Drop down menus

Blair McGlashan
"Peter Simmonds" <[hidden email]> wrote in message
news:40b72139$[hidden email]...
> How can I create a dropdown menu? I can do the View Composer stuff and
> create the button ok but I can find no way of creating the actual menu nor
> how to connect it to the button.
>
> Can anyone help?
>

Do you mean a drop-down toolbar menu like the history drop-downs in the main
Dolphin class browsers? If so start browsing from
ClassBrowserAbstract>>onDropDown:. This is an event handler which has been
hooked up (in ClassBrowserAbstract>>onViewOpened) to the #dropDown: event
triggered by the toolbar in its #tbnDropDown: method, which is handling a
direct notification from the Windows control. The argument to #dropDown: is
the tool bar button itself that was pressed. The CHB builds a Menu
dynamically (ClassBrowserAbstract>>buildHistoryPastMenu), and then shows it
with Menu>>showIn:position:. Normally you should run a command query before
popping up the menu to enable/disable the entries as appropriate, this is
done by sending #queryAllFromView: to the Menu (e.g. see
PackageBrowserShell>>onDropDown:). The CHB doesn't do that for the history
menus since it is not necessary. That's all you need do; any commands
selected from the menu will be processed in the normal way as if issued from
any other menu or toolbar (or other command source).

BTW: I couldn't remember off the top of my head how to do this, so I used
the Visual Object Finder (the magnifying glass with dolphin ball icon on the
toolbars) to open an inspector on the relevant toolbar of a browser. Some
windows, like the browsers, contain more than one toolbar nested within an
overall toolbar, so its necessary to click in the right position to open the
inspector on the right one - I just clicked over a disabled history back
button in a new browser window. Then I looked at the 'items' aspect of the
toolbar and located the likely button, in this case the one which sends the
message #historyBack as its command. I then just browsed for references to
#historyBack, and narrowed those down to the ones in ClassBrowserAbstract
(by sorting the Method Browser by class). Of the three,
ClassBrowserAbstract>>onDropDown: sounded promising. so investigated from
there.

Regards

Blair