April 16, 2024, 11:50:37 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Bitmap button

Started by Andy, June 29, 2018, 01:34:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

June 29, 2018, 02:40:19 AM #1 Last Edit: June 29, 2018, 03:01:27 AM by Egil
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.

Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

June 29, 2018, 09:22:18 AM #3 Last Edit: June 29, 2018, 09:24:16 AM by Egil
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.
Support Amateur Radio  -  Have a ham  for dinner!

Andy

Egil,

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

Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.