Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I nedd a toggle button that supports 2 gyphs

Status
Not open for further replies.

ivoestg

Programmer
Mar 21, 2001
77
0
0
PT
Hello

I need a toggle button for delphi 6 that supports 2 different glyphs. One when its down, and the other when its up. Were can i find this?? its urgent... thanks...

I'm in ivoestg@yahoo.com
 
hi,

put an image list on your form and change the glyph property of the speedbutton or the bitbutton when you press it.

Steph [Bigglasses]
 
ivoestg,

You already have one provided with the VCL: TSpeedButton.

To get it to act the way you want:

1. Drop a TSpeedButton on your form.

2. Set its GroupIndex property to a unique value.

3. Set AllowAllUp to True

4. Create a glyph containing four bitmaps of the same size. For example, if you want to use 16x16 images for the glyphs, create a bitmap that's 64 pixels wide and 16 high. See the Help topic for TSpeedButton.Glyph for the proper arrangement of the individual images.

5. Assign your bitmap to the button's Glyph property.

6. Verify that the NumGlyphs property is now set to four. If its not, then you may wish to review the construction of your bitmap. The IDE contains some logic that tries to determine the number of glyphs in the image. It works, but only when everything is properly defined.

You can determine the button's state at runtime by checking the Down property. For example:

Code:
   if SpeedButton1.Down then
      messageBeep( MB_ICONEXCLAMATION )
   else
      messageBeep( MB_OK );

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top