Link to home
Start Free TrialLog in
Avatar of VSF
VSFFlag for Brazil

asked on

Bitbtn Glyphs

I have 2 Tbitbtn, with 2 different caption "Add" and "Edit", when the user press any of then, I change the caption to "Save" and "Cancel".  
(the button's code has an IF statement depending of the table state i'm working on)
So I changed the caption, but how can I change the glyph using a Timagelist?
I added the images to the imagelists but I dont know how to make it changes!!!
Avatar of DrDelphi
DrDelphi

You can use the GetBitmap method of the TimageList:

 ImgList.GetBitmap(0,bitbtn.glyph);




Good luck!!
ASKER CERTIFIED SOLUTION
Avatar of mhervais
mhervais

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
TPicture *imagem = new TPicture();

ImageList1->GetBitmap(0,imagem->Bitmap);
SpeedButton1->Glyph=imagem->Bitmap;



I think this might work


Note: this is C++builder code but i think it might be +- the same thing in delphi.

Good luck
  Filipe correia
same comment as Dr Delphi's
VSF,

I would not do this at all. I would use an ActionList component and assign an action to each button. I would then change the caption and the image index on the action for each button. This has the advantage of changing the text and image for an associated menu item at the same time as the bitbtn