Ooops
September 19, 2021, 12:40:48

Author Topic: Any way to add an image to menu items in the empty space on the left hand side?  (Read 1198 times)

Offline braxtonrivers

  • Jr. Member
  • **
  • Posts: 35
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

Offline bsisko

  • Full Member
  • ***
  • Posts: 125
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!

https://www.youtube.com/channel/UCtF5_0dBPL5eSBerwlJCnPA

Offline braxtonrivers

  • Jr. Member
  • **
  • Posts: 35
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

Offline Henri

  • Sr. Member
  • ****
  • Posts: 353
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
  1. Import MaxGui.Drivers
  2.  
  3. Local img_12:TPixmap = LoadPixmap("img_12.png")
  4. Local img_16:TPixmap = LoadPixmap("img_16.png")
  5. Local img_24:TPixmap = LoadPixmap("img_24.png")
  6. Local img_32:TPixmap = LoadPixmap("img_32.png")
  7.  
  8. Local menu:TGadget = CreateMenu("popup", 0, Null)
  9. Local menu_1:TGadget = CreateMenu("Image 12 x 12", 101, menu)
  10. Local menu_2:TGadget = CreateMenu("Image 16 x 16", 102, menu)
  11. Local menu_3:TGadget = CreateMenu("Image 24 x 24", 103, menu)
  12. Local menu_4:TGadget = CreateMenu("Image 32 x 32", 104, menu)
  13.  
  14. SetGadgetPixmap(menu_1, img_12)
  15. SetGadgetPixmap(menu_2, img_16)
  16. SetGadgetPixmap(menu_3, img_24)
  17. SetGadgetPixmap(menu_4, img_32)
  18.  
  19. Local window:TGadget = CreateWindow("Test PopupWindowMenu", 20, 20, 200, 200, Null, WINDOW_DEFAULT | WINDOW_CENTER)
  20. Local panel:TGadget = CreatePanel(0, 0, ClientWidth(window), ClientHeight(window), window, PANEL_ACTIVE)
  21.  
  22. While True
  23.  
  24.         WaitEvent()
  25.  
  26.         Select EventID()
  27.                 Case EVENT_MOUSEDOWN
  28.                         If EventData() = 2 Then PopupWindowMenu(window, menu)
  29.                 Case EVENT_WINDOWCLOSE
  30.                         End
  31.                 Case EVENT_MENUACTION
  32.                         Print "EVENT_MENUACTION: eventdata() = " + EventData()
  33.         End Select
  34. Wend
  35.  

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

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal