PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Dennis Allen on April 22, 2013, 06:06:31 PM

Title: Image Buttons
Post by: Dennis Allen on April 22, 2013, 06:06:31 PM
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
Title: Re: Image Buttons
Post by: Paul Squires on April 23, 2013, 09:41:41 AM
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.
Title: Re: Image Buttons
Post by: Dennis Allen on April 23, 2013, 08:57:27 PM
Thank you for your help.