Page 1 of 1

Owner drawn menus - UPDATED.

Posted: Wed Nov 23, 2005 1:15 am
by srod
Hi,

I've been tinkering with owner drawn menus, searching for an easy mechanism for changing colours and mixing text and icons etc. and have hashed up a little include file which others might find useful.

Features:
  • easily mix text and icons
  • colour individual menu items (text and background)
  • justify the text in individual menu items
  • use multiple fonts
  • set different heights for individual menu items
  • choose to have a border surround the highlighted menu item etc.
I've tested it with regular menus and a little bit with popup menus and all seems to work okay. No documentation I'm afraid, but the example program should make it clear how to use the little library.

The code is based on a routine I found on purearea.net

Click to download

Posted: Wed Nov 23, 2005 3:50 am
by Joakim Christiansen
Nice :D

Posted: Wed Nov 23, 2005 11:29 am
by A.I
Can anybody confirm this works on Win9x/Me?
Just curious.

I only have XP systems here, and seems to work like a dream.

Posted: Wed Nov 23, 2005 1:45 pm
by srod
Worked okay on Win 98 when I tried.

Posted: Wed Nov 23, 2005 2:48 pm
by rsts
Pretty nice.

Thanks srod.

Posted: Wed Nov 23, 2005 3:42 pm
by Dare2
Hi srod,

Very nice. Thank you for this.

Posted: Wed Nov 23, 2005 7:21 pm
by srod
You're welcome.

Credit due to Andreas for posting the code which this is based upon in the Purearea site.

Posted: Thu Nov 24, 2005 9:00 pm
by srod
Update: The library now reacts to the usual Purebasic command

Code: Select all

DisableMenuItem()

appropriately by greying the text and refusing to allow the selection of the item etc.

Posted: Sat Nov 26, 2005 12:19 pm
by gnozal
Thanks, but one little error : member 'enabled' is missing in structure 'iMenuItem'.

Code: Select all

Structure iMenuItem ;Used to store information on individual menu items.
  id.l
  hMenu.l
  enabled.l ; <- fixed ///////////
  height.l
  lefttextmargin.l
  textcolour.l ;Unselected colour.
  backcolour.l ;Unselected colour.
  hFont.l ;Handle to the font to be used.
  textjustification.l ;One of '#ES_CENTER', '#ES_LEFT', '#ES_RIGHT'.
  hIcon.l ;Handle to the icon to be used.
EndStructure 

Posted: Sat Nov 26, 2005 12:34 pm
by srod
Thanks Gnozal, but that member is not, or should not be used. If any of the code references this member then the code needs removing. I'll have a check and upload a new version if necessary.

Edit: new version uploaded.

Posted: Fri Jan 04, 2008 4:30 am
by Seymour Clufley
The link in the OP doesn't work. Does anyone have the include? It would be much appreciated, seems like a useful piece of code.

Posted: Fri Jan 04, 2008 11:42 am
by srod
Hi seymour,

I basically replaced this code with a simpler and more efficient offering and so removed the download some time ago.

Here's a link to the updated code :

http://www.purebasic.fr/english/viewtop ... menu+icons

Posted: Sun Jan 06, 2008 8:02 pm
by Seymour Clufley
Thanks a lot, Srod. That's much appreciated. :)