icon on buttons

BlitzPlus Forums/BlitzPlus Programming/icon on buttons

LAB[au](Posted 2003) [#1]
Is there any way of creating a button with an icon on it? I would like to have a "play" button (with a green triangle) that switch to a "pause" button (with two parallel bars) when pressed.

Thanks


soja(Posted 2003) [#2]
There may be a way with userlibs, but not as yet natively. I seem to remember in the worklogs (maybe) that Mark mentioned something like this for a future addition.


cyberseth(Posted 2003) [#3]
You can do it with canvases. Create a small canvas the size of the button and DrawImage the button on to it. I do this with all my graphical buttons and it works great! (I believe ProPixel2D also does this.)

If you want the button to have proper system 3D colours, there is a GetSysColor or GetSystemColor API call.


LAB[au](Posted 2003) [#4]
When using canvas the size of the button, I can't press the button anymore, the overlapping area of canvas and button "hides" the button. Any trick for this?

Thanks.


CS_TBL(Posted 2003) [#5]
@LAB[au]

I think they mean not using a button at all, just a canvas alone!

like this ..

mybutton=createcanvas(100,100,32,32,parent)

; eventcheck routine:
if eventid()=$201 ;canvas mouse down
if eventsource()=mybutton
if eventdata()=1 ; left mouse button
your blahblah here..
endif
endif
endif


Ofcourse, doing a really 'clickable' 3d button is something different here. But having 3 versions of 1 icon, like in propixel, seems to work fine.. one greyscale (not used), one greyscale with the icon in color (mouse moving over it), and one in full color (selected).