Navigation:  Reference > Form Objects >


Print this Topic Previous pageReturn to chapter overviewNext page


This will display a slightly different Windows button on the form.  In this case the button can have a glyph (.bmp graphic) that is part of the button along with the caption.  If you don't include the graphic this is identical to the standard TButton object.


The user will be able to 'click' on this button (press the left mouse button while the arrow is over the object) and have this execute an Event that will call a routine in your program.  The icon for this object is on the Standard page.






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.




GlyphIf 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.




CancelIf this is checked (set to .True.) the Click event (see below) will execute if the user presses the ESC key.  This property can be set during runtime.


DefaultIf this is checked (set to .True.) the button will be the default object on the form.  This means if the user presses the ENTER key it will have the same effect as if they had clicked the button.


       NOTE:  If you have entry objects on the form, e.g. TTASEnter, with the ReturnIsTab property checked (set to .True.) then this will be ignored.






























GlyphKindThis will determine what appears on this object.  The options are:  bkCustom (this will use what ever you have chosen in the Glyph property above - this is the default value), bkOK (sets the ModalResult property to mrOK), bkCancel (sets the ModalResult property to mrCancel), bkHelp (sets the ModalResult property to mrNone), bkYes (sets the ModalResult property to mrYes), bkNo (sets the ModalResult property to mrNo), bkClose (sets the ModalResult property to mrNone), bkAbort (sets the ModalResult property to mrAbort), bkRetry (sets the ModalResult property to mrRetry), bkIgnore (sets the ModalResult property to mrIgnore) and bkAll (sets the ModalResult property to mrAll).  Each one of these options has their own unique glyph except for bkCustom which has none.  The options are defined in COMPILERCONSTANTS.TXT and can be modified during runtime.


LayoutThis determines where the glyph will be displayed in relation to the caption.  The default is blGlyphLeft.  The other options are:  blGlyphBottom (under the caption), blGlyphRight (to the right of the caption) and blGlyphTop (on top of the caption).


MarginThe number of pixels between the glyph and the sides of the button.  The default value of -1 will center the Glyph and the Caption on the button face.  This property can be modified during runtime.


ModalResultIf this button is on a form loaded using the LOAD_MODAL_FORM() function this would be one way to set the Modal_Result property for that form.  This will release the form and return the appropriate value from the function.  If it is placed on a non-modal form (most often) you can still determine which button is calling by setting up a separate event (see below) or putting a value in the Tag property and checking that property in the common event called.  These values are defined in COMPILERCONSTANTS.TXT.  This property can be modified during runtime.


NumGlyphsIf you have two glyphs that can be displayed, one normally, and the second when the user clicks the button, then this would be two.  The default value is one.  This value changes automatically depending on the GlyphKind property.


SpacingThis is the number of pixels between the glyph and the Caption.  The default value is 4 and can be changed during runtime.


StyleThis controls what the button looks like.  You should leave it set on bsAutoDetect.












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:  You can have multiple buttons call the same routine by 'stacking' the event labels on top of each other.  For example, if you had two buttons you wanted to call the same event, you could do the following:

//event routine code would go here.



The labels are not part of the code executed.  They are just place keepers and tell the program where to go.




Page url: