Any way to add an image to menu items in the empty space on the left hand side?

Started by braxtonrivers, January 11, 2020, 22:38:45

Previous topic - Next topic

braxtonrivers

Hi everyone,

I was just wondering if there was any way that an icon/image can be added to menu items in the empty space on the left hand side?

I was hoping to add them to the menus in MaxIDE on windows to start with if it was possible, any help is appreciated.

Thanks in advance
braxton

Amanda Dearheart

I'm more of a Blitz3d user than an Blitzmax user, but post the commands that you are using (not your code) to create the menus, and I'll check blitzmax manuals to see if it possible.
Prepare to be assimilated !  Resistance is futile!

braxtonrivers

Hi,

Thanks for the reply,

I have been trying to use SetGadgetPixmap with the GADGETPIXMAP_ICON flag set

I just found this thread by degac and it appears that it still isn't working unfortunately, I thought I was doing something wrong as the menu shows correctly but the icons do not.
https://www.syntaxbomb.com/index.php?topic=4349.0

Thanks in advance
braxton

Henri

Hi,

this is somewhat late reply (sorry about that), but I recently got involved in menu icons and made a little test program.

This example loads different size images to see what the outcome is, and what I get from it is that optimal size seems to be 16 x 16 (all are displayed but larger images do not show fully). I'm on Windows environment so results may vary.

Code (blitzmax) Select

Import MaxGui.Drivers

Local img_12:TPixmap = LoadPixmap("img_12.png")
Local img_16:TPixmap = LoadPixmap("img_16.png")
Local img_24:TPixmap = LoadPixmap("img_24.png")
Local img_32:TPixmap = LoadPixmap("img_32.png")

Local menu:TGadget = CreateMenu("popup", 0, Null)
Local menu_1:TGadget = CreateMenu("Image 12 x 12", 101, menu)
Local menu_2:TGadget = CreateMenu("Image 16 x 16", 102, menu)
Local menu_3:TGadget = CreateMenu("Image 24 x 24", 103, menu)
Local menu_4:TGadget = CreateMenu("Image 32 x 32", 104, menu)

SetGadgetPixmap(menu_1, img_12)
SetGadgetPixmap(menu_2, img_16)
SetGadgetPixmap(menu_3, img_24)
SetGadgetPixmap(menu_4, img_32)

Local window:TGadget = CreateWindow("Test PopupWindowMenu", 20, 20, 200, 200, Null, WINDOW_DEFAULT | WINDOW_CENTER)
Local panel:TGadget = CreatePanel(0, 0, ClientWidth(window), ClientHeight(window), window, PANEL_ACTIVE)

While True

WaitEvent()

Select EventID()
Case EVENT_MOUSEDOWN
If EventData() = 2 Then PopupWindowMenu(window, menu)
Case EVENT_WINDOWCLOSE
End
Case EVENT_MENUACTION
Print "EVENT_MENUACTION: eventdata() = " + EventData()
End Select
Wend


-Henri
- Got 01100011 problems, but the bit ain't 00000001