Button Pixmaps

BlitzMax Forums/MaxGUI Module/Button Pixmaps

Ghost Dancer(Posted 2010) [#1]
I'm trying to create some buttons with images. I'm using LogicGui to create the code but have also tried fiddling with it and just cannot get it to work.

But = CreateButton("",13,14,109,72,tabber_Tab2,BUTTON_PUSH|BUTTON_RADIO)
Local Pixmap_But:TPixmap = LoadPixmapPNG ( "image.png" )
SetGadgetPixmap( But , Pixmap_But ,GADGETPIXMAP_ICON|GADGETPIXMAP_NOTEXT )


Am I doing something wrong?


jsp(Posted 2010) [#2]
IIRC no radio, checkbox or OK buttons are allowed for cross-platform reason.
So try a simple push or cancel button.

[EDIT] mixed ok and cancel button and corrected it.


Ghost Dancer(Posted 2010) [#3]
Yeah, I tried all types and none of them work.


jsp(Posted 2010) [#4]
I just tried it and it's working here fine for standard push buttons and cancel buttons!
I'm using MaxGui 1.39 and checked with different images, all are working.
Could it be your chosen image?


Ghost Dancer(Posted 2010) [#5]
Hmm, could be but its just a simple png. I'll try it with a different image and see if that works.

Did you try it with a push radio button? As that's what I'm aiming for. If not I'll have to code my own, poss using the new panel sunken/raised borders :)


SebHoll(Posted 2010) [#6]
@Ghostdancer:

What platform are you on?


jsp(Posted 2010) [#7]
I did the first test on XP and have now also checked Win7 Home 64 bit, both do work for me.
Push radio buttons are no problem, worked fine.


Ghost Dancer(Posted 2010) [#8]
I've tried different images but no joy :(

I'm using Windows XP


jsp(Posted 2010) [#9]
Did you try rebuilding MaxGui, not that I see a specific reason, but just to make sure your installation is ok.


Ghost Dancer(Posted 2010) [#10]
Aye, tried that and I'm using then latest version of maxgui (1.4)


SebHoll(Posted 2010) [#11]
Aye, tried that and I'm using then latest version of maxgui (1.4)

Short, self-contained runnable code example please. :-)


Ghost Dancer(Posted 2010) [#12]
Was already writing a short example and as it happens it works just fine. There must be something in my main application thats preventing it from working but not sure what (its using identical code).

Sorry to have bothered you with this and thanks for helping. I'll investigate further...


SebHoll(Posted 2010) [#13]
You don't happen to be importing an executable icon into the project, do you? Using an object (.o) file? Does it automagically work if you comment your import out? :-)


Ghost Dancer(Posted 2010) [#14]
Ah, that's exactly what I'm doing and if I comment out the import the button pixmap does indeed work :) Good call, thank you, I would never have figured that out.

How come the import stops it working and is there any way around this?


SebHoll(Posted 2010) [#15]
You have to make sure that when you create your object file, you also include a manifest file so that Windows uses the latest version of its common control library (which have icon support). When you import your own object file, it overrides the default manifest object file which Win32MaxGUIEx includes, which explains why the examples work, but your project doesn't.

See here for information on creating an all-in-one object file.


Ghost Dancer(Posted 2010) [#16]
Nice one, thanks Seb. All working now :)