Office-style menus (full include) - 20Feb2013 [x86 / x64]
Posted: Tue Oct 16, 2012 6:06 pm
I have finally finished an old project of mine, an include for creating custom menus that look like the ones from Office. The idea is inspired by that of eesau that can be found here:
http://www.purebasic.fr/english/viewtopic.php?t=27233.
This one is a complete library, written from scratch. The system itself is modeled after PureBasic's menu lib to make it easy to implement, without having to modify too much code. Some features:
As for older operating systems, I did try to make this code compatible with them. The tests on Window$ 98 looked promising, except for a single thing that I would like to hear an explanation for: after you play with the menu in its current form and you enter sub-menus, next time you open them, the menu item states do not reset
. So if one item was highlighted when you click somewhere to close the menu and you open it again, the items are drawn as highlighted even if the cursor does not hover over them. I even tried to reset their state by force upon #WM_INITMENUPOPUP, but to no avail. Inconsistent menu implementation is inconsistent, but if you have any idea why this happens, please let me know. On the other hand, in Win2K things went better, even if the slightest drawing mistake would break all other menus. I found this to be a good guide while implementing the drawing code because it reduced the risk of bugs slipping in.
And another cool one: on Window$ 8, the menus are automatically opened to the left. This makes things look ackward. Much to my amazement, system menus behave the same way, opening sub-menus to the left, even if the arrows are drawn on the right (
) and there is enough space to the right edge of the screen (gotta love these 'great new features'). So after fiddling around for some time I found a way to show the menus the good ol' way from Control Panel, in Tablet PC -> Handedness. What on earth is happening @ M$?
Screenshots:


That being said, enjoy:
BE_OfficeMenu.zip, 16 KB
http://www.bytessence.com/download/snip ... ceMenu.zip
Changelog:
http://www.purebasic.fr/english/viewtopic.php?t=27233.
This one is a complete library, written from scratch. The system itself is modeled after PureBasic's menu lib to make it easy to implement, without having to modify too much code. Some features:
- - Close resemblance to Office menus
- You can add new styles (colors) and change them in real time
- Own management system for Office Menu 'objects' (with IDs, etc.)
- Should work on: Window$ 2000, XP, Vista, 7, 8 (32 / 64 bit, Unicode supported)
- Support for keyboard navigation and mnemonics
- Open source
As for older operating systems, I did try to make this code compatible with them. The tests on Window$ 98 looked promising, except for a single thing that I would like to hear an explanation for: after you play with the menu in its current form and you enter sub-menus, next time you open them, the menu item states do not reset

And another cool one: on Window$ 8, the menus are automatically opened to the left. This makes things look ackward. Much to my amazement, system menus behave the same way, opening sub-menus to the left, even if the arrows are drawn on the right (

Screenshots:


That being said, enjoy:
BE_OfficeMenu.zip, 16 KB
http://www.bytessence.com/download/snip ... ceMenu.zip
Changelog:
20 February 2013:
-Fixed a crash when showing menus from the systray
-Added double buffering (no more flickering)
-Added OfficeMenu_IsMenu procedure
-Switched all data types to integers to avoid potential problems on x64
4 November 2012:
-Added x64 support
16 October 2012:
-First release