Maxgui - button with image?

BlitzMax Forums/BlitzMax Programming/Maxgui - button with image?

xlsior(Posted 2015) [#1]
I'm making a basic maxgui app which is coming along very nicely, but am running into a snag that I can't seem to figure out:

I have a panel named panel[1] that gets drawn.

Button7:tgadget=Createbutton("", 100,100,100,100,panel[1],BUTTON_PUSH)

This draws the button, I can click it, etc... But is there any way to draw a pixmap onto it?
I tried this, but seems to do nothing:

Setgadgetpixmap(button7:tgadget,loadpixmap("pixmap.png"), GADGETPIXMAP_ICON)
Redrawgadget(button7:tgadget)

Does anyone have any pointers?


markcw(Posted 2015) [#2]
I think you have to use an ImageGadget for this.


Brucey(Posted 2015) [#3]
The code implies it should work :
gadget SetPixmap()...

If (pFlags & GADGETPIXMAP_ICON) And (((style&BUTTON_PUSH)=BUTTON_PUSH) Or (style = BUTTON_CANCEL)) Then ...

Is your pixmap actually loading?


xlsior(Posted 2015) [#4]
Yes - I also had the load pixmap go to a tpixmap variable - I can draw it to a panel background just fine, but it won't appear on the pushbutton.

In the help, those are not listed as an exception that doesn't work on all platforms like the ok button...

(this is on Windows, by the way)


Brucey(Posted 2015) [#5]
Have you got the correct manifest and enabled themes? :-)


Brucey(Posted 2015) [#6]
Well, I've messed around with all kinds of stuff, and I just cannot get
If Not SendMessageW (_hwnd, BCM_SETIMAGELIST, 0, Int Byte Ptr _buttonImageList) Then

to return True...

Presumably it would be drawing on the button if this command succeeded?

You wanna get Mister Skid to tell us how to do it properly ;-)


xlsior(Posted 2015) [#7]
No idea how to even check manifest...
Do have windows themes.

Is there any way to see if someone clicks on a panel? If so, I can draw it on the background...


Brucey(Posted 2015) [#8]
Is there any way to see if someone clicks on a panel? If so, I can draw it on the background

Yes, you can make a panel active - which then accepts mouse inputs. There should be an example in the maxgui docs.