IonicWind Software

IWBasic => General Questions => Topic started by: Andy on June 29, 2018, 01:34:48 AM

Title: Bitmap button
Post by: Andy on June 29, 2018, 01:34:48 AM
Does any one know how to change a bitmap image for a button.

This loads an image to the button:

CONTROL mainwindow,@BUTTON,"",230,50,30,25,@CTLBTNBITMAP,BUTTON_4
SETCONTROLTEXT mainwindow,BUTTON_4,GETSTARTPATH+"tabclose.bmp"


But can I change it?

Or do I have to destroy the button and create a new one? or can you use SENDMESSAGE, if so how?

Thanks,
Andy.
Title: Re: Bitmap button
Post by: Egil on June 29, 2018, 02:40:19 AM
Hi Andy,

With CB  the bitmap can be changed at any time by using SETCONTROLTEXT. Think it will the same way with IWB.

Your code example looks ok to me. Just change the bitmap name to whatever you need.
SETCONTROLTEXT mainwindow,BUTTON_4,GETSTARTPATH+"YourOwnBitmap.bmp"

Good luck
Egil



P.S.
Had to try with IWB. Attached an example.

Title: Re: Bitmap button
Post by: LarryMc on June 29, 2018, 07:33:17 AM
Perfect example Egil!
Title: Re: Bitmap button
Post by: Egil on June 29, 2018, 09:22:18 AM
Thanks Larry, but my granddaughter (12) says that the example also could have been set up to the  program language change when changing the flag.... maybe a good idea for a future project.
Title: Re: Bitmap button
Post by: Andy on June 29, 2018, 09:53:53 PM
Egil,

Thanks for posting that, it does work for me too.

Andy.