Navigation:  Reference > Form Objects >


Print this Topic Previous pageReturn to chapter overviewNext page


The Speed Button object (TSpeedButton) which usually have images on their faces, can function in groups. They are commonly used with panels to create toolbars. The icon for this object is on the Standard page.



Use TSpeedButton object to add a button to a group of buttons in a form. TSpeedButton introduces properties that can be used to set graphical images that represent the different button states (selected, unselected, disabled and so on). Use other properties to specify multiple images or to rearrange the images and text on the button. TSpeedButton also introduces properties that allow speed buttons to work together as a group. Speed buttons are commonly grouped in panels to create specialized tool bars and tool palettes.







The following are the properties that apply to this object.  Some are defined in Common Properties and are linked to their appropriate page.




      CaptionThis is the text that is displayed on the face of the button.  This is any standard string and can be changed at runtime.




       Glyph          If you have chosen a custom glyph (bkCustom) in GlyphKind below this is where you would choose the .bmp file that would be used instead of the standard ones that come with this object.


























      AllowAllUp    Specifies whether all speed buttons in the group that contains this speed button can be unselected at the same





Down            Specifies whether all speed buttons in the group that contains this speed button can be unselected at the same time.


      Layout          Determines where the image or text appears on the speed button.


     Margin          Use Margin to specify the indentation of the image specified by the Glyph property or the text specified by the Caption             property. The edges that Margin separates depends on the Layout property. If Layout is blGlyphLeft, the margin             appears between the left edge of the image or caption and the left edge of the button. If Layout is blGlyphRight, the             margin separates the right edges. If Layout is blGlyphTop, the margin separates the top edges, and if Layout is              blGlyphBottom, the margin separates the bottom edges. If Margin is 1, the image or text is centered on the button.


      NumGlyphs    Set NumGlyphs to the number of images provided by the bitmap assigned to the Glyph property. All images must be the same size and next to each other in a row. The Glyph property can provide up to four images.


      Spacing         Set Spacing to the number of pixels that should appear between the image specified in the Glyph property and the text specified in the Caption property.  If Spacing is a positive number, its value is the number of pixels between the image and text. If Spacing is 0, the image and text appear flush with each other. If Spacing is -1, the text appears centered between the image and the button edge.











This object has a single event that is called if your user clicks the button.  This event looks to your program for a special label.  It is made up of the object Name, a period (.) and the Event name (Click).  The full event name would be ObjectName.Click:.  You would not return a value from the program, just a simple RET is all that is required.  So, the user clicks the button, if the event label exists the routine is called, you return from the routine, and the user has control again.


NOTE:  To make speed buttons act as a group, give the GroupIndex property of all the buttons the same nonzero value. By default, speed buttons appear in an up (unselected) state. To initially display a speed button as selected, set the Down property to True. If AllowAllUp is True, all of the speed buttons in a group can be unselected. Set AllowAllUp to False if you want a group of buttons to act like a radio group.


Tip: To create a speed button with a client-aligned glyph that covers the button's edges, add a 1-pixel margin around the button's top and left edges and a 3-pixel margin around its bottom and right edges. Do this by manually editing the bitmap specified by the Glyph property.


Page url: