size : 673
uploaded_on : Mon Apr 26 00:00:00 1999
modified_on : Wed Dec 8 14:03:39 1999
title : Changing buttons image
org_filename : Glyph.txt
author : Kim Sandell
authoremail : kim.sandell@ericsson.fi
description : How to change image on a button after click on it
keywords :
tested : not tested yet
submitted_by : The CKB Crew
submitted_by_email : ckb@netalive.org
uploaded_by : nobody
modified_by : nobody
owner : nobody
lang : plain
file-type : text/plain
category : delphi-commoncontrols
__END_OF_HEADER__
> I have a button with an icon on it and I want it to change to a
> different icon when it is clicked and vies versa when clicked does
> anyone know how to do this an example would help a lot
Change the Glyph in the button, and Refresh; it. That should
do the trick. You need both Bitmaps in memory ofcourse.
The example changes the bitmap on the button acording to the tag
of the button itself, switching between Image1 and Image2.
Example:
Procedure Switcher;
BEGIN
BitBtn5.Tag := 1 - BitBtn5.Tag;
If BitBtn5.Tag=0 then
BitBtn5.Glyph := Image1.Picture.Bitmap
Else
BitBtn5.Glyph := Image2.Picture.Bitmap;
BitBtn5.Refresh;
END;