Image Buttons

Started by Dennis Allen, April 22, 2013, 06:06:31 PM

Previous topic - Next topic

Dennis Allen

Hi,

I am needing that change the icon or bitmap displayed on a image button depending on the state of variables assigned to it. Is this done in FireFly with the DDT "CONTROL SET IMAGE hDlg, id&, newimage$"?  Or is there a FF_SET_IMAGE function that I missed?
Thank you in advance.

Ron

Paul Squires

Hi Ron,

You would use the %BM_SETIMAGE message to change the image. You can only use ICONS or BITMAPS with the image button.
http://msdn.microsoft.com/en-ca/library/windows/desktop/bb761822(v=vs.85).aspx
http://msdn.microsoft.com/en-ca/library/windows/desktop/ms648045(v=vs.85).aspx

The following code displays a 16x16 icon that is in the FireFly Image Library.


   SendMessage HWND_FORM1_IMAGEBUTTON1, %BM_SETIMAGE, %IMAGE_ICON, LoadImage( App.hInstance, "IMAGE_LINK", %IMAGE_ICON, 16, 16, %LR_DEFAULTCOLOR Or %LR_SHARED)


If you don't use the LR_SHARED flag then you should use DeleteObject to free the image when you are finished using it.
Paul Squires
PlanetSquires Software

Dennis Allen

Thank you for your help.