Dolphin Menu addons

By: Steve Waring
Home Pages: Journal Dolphinharbor
Created: 20021031
Last Update: 20021115


Overview

The following is released as TestWare ... if you have a problem with the code or technique in your environment, you will be doing me a big favor by letting me know about it


Menu Select

This package enables the typical behavior of displaying extended help strings for menus in the status bar area.

It is implemented by adding a handler for the windows WM_MENUSELECT message. From this message, the relevant CommandDescription is located, and an event is triggered off the presenter with the commandDescription as an argument.

MenuSelect

The second package in the download is a sample which shows one way to use this to display status bar help. This sample has been deployed as a test ToGo application. If you have any problems running this in your environment please let me know about it.

The test ToGo has been run successfully on WinXP, Win2k and Win95 machines.

Menu Select - Download

Update - 20021115

To make it easier to display status help only when a menu item is selected, in my image I have modified the following base method:

View>>wmExitMenuLoop: message wParam: wParam lParam: lParam
"Private - The system has exited the modal menu loop.
Implementation Note: See wmEnterMenuLoop:&c. We must ensure the idle
kick timer is killed."

SessionManager inputState stopIdleTimer: self.
self presenter onMenuSelected: nil.
^nil

The above method is not included in the downloads, and should be used with caution.


Menu Info

This package plays around with the MENUINFO structure and SetMenuInfo function. What lead me to this function, was looking for a way to remove the extra "column" from a menu with bitmaps. This can be seen on Win2k in the Tools and Windows menus:

MenuInfo1

It turns out that Windows is reserving space for both a check-mark and the bitmap. MENUINFO can be used to tell Windows to reserve space for either a check-mark or a bitmap:

MenuInfo2

For my current needs, this will probably do the trick, however there are other effects that can be achieved. For example you can set the background brush:

MenuInfo3

This gives the Win2k menus a WinXP look. My investigation into the Office Menu look suggests the only way to achieve it, is to use owner-draw menus, and this looks like alot of work ... certainly more than I am prepared to do.

Lastly, you can use a bitmap (in this case the Dolphin splash screen bitmap) to construct the brush, and come up with effects like:

MenuInfo4

The Good ... I think I will only end up using this to remove the extra space reserved for the check-mark.

The Bad ... The package replaces Menu>>showIn:position and Menu>>insertIntoMenu:at:info. It replaces MENUINFO(class)>>defineFields and compiles the definition in an install script so that the structure's accessors are generated. It replaces MENUITEMINFOV5>>bitmapFromIcon: so that it can override the background color of the bitmaps created from icons.

The Ugly ... I have taken a global approach; trying to intercept when menus are created, and asking a global to use a single instance of MENUINFO to set the menu. It is ugly. I think that Menu would need to be modified for a proper implementation of this function.

This download includes a second sample package. This sample has been deployed as a test ToGo application. If you have any problems running this in your environment please let me know about it.

MenuInfo5

The test ToGo has been run successfully on WinXP, Win2k. It fails (gracefully) on a Win95 machines. I dont have access to a Win98 or WinNT machine at the moment. Can you help? The ToGo needs to be installed into a directory with the DolphinDR005.dll (not included) and a subfolder "Resources" where it will look for a bitmap named "Dolphin1.bmp" The best place to find this is the "Program Files\Object Arts\Dolphin Smalltalk 5.0" folder.

Menu Info - Download


Copyright Steve Waring 2002.