ButtonGadgetEx.pbi (buttons with image and text), v0.4
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
Is there any way to use *.png images with this?
I've tried and although they load and the buttons are created, the images are missing, but text is offset.
I've tried and although they load and the buttons are created, the images are missing, but text is offset.
%101010 = $2A = 42
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
@Rook - For text overlaying an Icon, I've managed it.
Adding a few line to the 'ButtonGadgetEx.pbi' file.
Add
in the Enumeration section.
and add
into the WndProc() procedure in the Select *Prop\ImagePosition section (Around line 160)
Then use the #BIGE_Overlay constant when creating your gadget.
Adding a few line to the 'ButtonGadgetEx.pbi' file.
Add
Code: Select all
#BIGE_Overlay
and add
Code: Select all
Case #BIGE_Overlay
ImageX = (Width-ImageWidth(*Prop\ImageID))/2
ImageY = (Height-ImageHeight(*Prop\ImageID))/2
TextX = (Width-SZ\cx)/2
TextY = (Height-FontHeight)/2
Then use the #BIGE_Overlay constant when creating your gadget.
%101010 = $2A = 42
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
It should work with any image format in theory. The only problem is that I used the DrawIconEx_ API to draw the images on the buttons. This is because we need to draw on a system-offered HDC (which we get by using GetDC_). In order to draw other image formats we should use a function like PB's internal DrawImage(), but this function can't draw on HDCs, it can only draw on PureBasic objects. I know that when we still used PB3.94 some people played with the PB internals in such way that they could force the DrawImage() function to draw on such HDCs but I couldn't get it to work after the drawing lib was rewritten in latter PB versions.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
I've discovered Trond' thread, which has the ability to use png's
http://www.purebasic.fr/english/viewtop ... 12&t=41045
So I'm going to have a play, and see if I can have the best abilities of both.
Thanks.
http://www.purebasic.fr/english/viewtop ... 12&t=41045
So I'm going to have a play, and see if I can have the best abilities of both.
Thanks.
%101010 = $2A = 42
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
I've also noticed, when pressing a ButtonGadgetEx, the image is not displayed.
Is that fixable?
Is that fixable?
%101010 = $2A = 42
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
That's rather strange, could you give me more info about that? Does the example in the archive work well for you?
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3
When running example, button 2 is disabled (as programmed), button 1 is displayed as expected, but when 'pressing' (and holding left mouse button) button1, the image disappears, when releasing LMB the image re-appears.
%101010 = $2A = 42
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3

My Mistake :roll: , I must have changed something in the include which broke it

I re-extracted them both and now works as it should.
Sorry!
%101010 = $2A = 42
Re: ButtonGadgetEx.pbi (buttons with image and text), v0.3

No problem at all, i'm glad it's ok. I thought that maybe it was an OS problem (I use XP here)

BTW, i uploaded a new version online that supports using your own callback... Check the example to see how to use it

None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)