| **Navigation:**  [[introduction.htm|Language Reference]] > 8 - Controls > Control Declarations >====== BUTTON (declare a pushbutton control) ====== | [[box declare a box control .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[check.htm|{{btn_next_n.gif|Next page}}]] | | || {{newc7.jpg|NewC7.jpg}} **BUTTON(**//text//),**AT( )** [,**CURSOR( )**] [,**USE( )**] [,**DISABLE**] [,**KEY( )**] [,**MSG( )**] [,**HLP( )**] [,**SKIP**] | | | [,**STD( )**] [,**FONT( )**] [,**ICON( )**] [,**DEFAULT**] [,**IMM**][,**REQ**] [,**FULL**] [,**SCROLL**] [,**ALRT( )**] || | | | [,**HIDE**] [,**DROPID( )**] [,**TIP( )**] [,**FLAT**] [,**REPEAT( )**] [,**DELAY( )**] | [,| **LEFT**| ] [,**TRN**] [,**LAYOUT**] | | | | [,**COLOR( )**] | | **RIGHT**| | {{blk2blue.jpg|blk2blue.jpg}} | **BUTTON** | Places a command button on the WINDOW or TOOLBAR. | | //text// | A string constant containing the text to display on the button face, along with any ICON specified (PROP:Text). This may contain an ampersand (&) to indicate the "hot" letter (accelerator key) for the button. | | **AT** | Specifies the initial size and location of the control (PROP:AT). If omitted, default values are set by the runtime library. | | **CURSOR** | Specifies a mouse cursor to display when the mouse is positioned over the control (PROP:CURSOR). If omitted, the WINDOW's CURSOR attribute is used, else the Windows default cursor is used. | | **USE** | A field equate label to reference the control in executable code (PROP:USE). | | **DISABLE** | Specifies the control appears dimmed when the WINDOW or APPLICATION is first opened (PROP:DISABLE). | | **KEY** | Specifies an integer constant or keycode equate that immediately gives focus to and presses the button (PROP:KEY). | | **MSG** | Specifies a string constant containing the text to display in the status bar when the control has focus (PROP:MSG). | | **HLP** | Specifies a string constant containing the help system identifier for the control (PROP:HLP). | | **SKIP** | Specifies the control does not receive input focus and may only be accessed with the mouse or accelerator key (PROP:SKIP). | | **STD** | Specifies an integer constant or equate that identifies a "Windows standard action" the control executes (PROP:STD). | | **FONT** | Specifies the display font for the control (PROP:FONT). | | **ICON** | Specifies an image file or standard icon to display on the button face (PROP:ICON). | | **DEFAULT** | Specifies the BUTTON is automatically pressed when the user presses the ENTER key (PROP:DEFAULT). | | **IMM** | Specifies the control generates an event when the left mouse button is pressed, continuing as long as it is depressed (PROP:IMM). If omitted, an event is generated only when the left mouse button is pressed and released on the control. | | **REQ** | Specifies that when the BUTTON is pressed, the runtime library automatically checks all ENTRY controls in the same WINDOW with the REQ attribute to ensure they contain data other than blanks or zeroes (PROP:REQ). | | **FULL** | Specifies the control expands to occupy the entire size of the WINDOW for any missing AT attribute width or height parameter (PROP:FULL). | | **SCROLL** | Specifies the control scrolls with the window (PROP:SCROLL). | | **ALRT** | Specifies "hot" keys active for the control (PROP:ALRT). | | **HIDE** | Specifies the control does not appear when the WINDOW or APPLICATION is first opened (PROP:HIDE). UNHIDE must be used to display it. | | **DROPID** | Specifies the control may serve as a drop target for drag-and-drop actions (PROP:DROPID). | | **TIP** | Specifies the text that displays as "balloon help" when the mouse cursor pauses over the control (PROP:ToolTip). | | **FLAT** | Specifies the button appears flat except when the mouse cursor passes over the control (PROP:FLAT). Requires the ICON attribute. | | **REPEAT** | Specifies the rate at which EVENT:Accepted generates when the button with the IMM attribute is held down by the user (PROP:REPEAT). Requires the IMM attribute. | | **DELAY** | Specifies the delay between the first and second generation of EVENT:Accepted for a button with the IMM attribute (PROP:DELAY). Requires the IMM attribute. | | **LEFT** | Specifies that the icon appears to the left of the //text// (PROP:LEFT). | | **RIGHT** | Specifies that the icon appears to the right of the //text// (PROP:RIGHT). | | **TRN** | Specifies that the characters print or display transparently without obliterating the background over which the control is placed. | | **LAYOUT** | Specifies the control's left-to-right or right-to-left display orientation (PROP:LAYOUT) | | **COLOR** | Specifies a background color for the control (PROP:COLOR). | The **BUTTON** control places a pushbutton on the WINDOW or TOOLBAR (not valid in a REPORT) at the position and size specified by its AT attribute. A BUTTON with the IMM attribute generates EVENT:Accepted as soon as the left mouse button is pressed on the control and continues to do so until it is released. This allows the BUTTON control's executable code to execute continuously until the mouse button is released. The rate and delay before continuous event generation can be set by the REPEAT and DELAY attributes. A BUTTON without the IMM attribute generates EVENT:Accepted only when the left mouse button is pressed and then released on the control. A BUTTON with the REQ attribute is a "required control fields check" button. REQ attributes of ENTRY or TEXT control fields are not checked until a BUTTON with the REQ attribute is pressed or the INCOMPLETE procedure is called. Focus is given to the first required control which is blank or zero. A BUTTON with an ICON attribute displays the image on the button face in addition to its //text// parameter (which appears below the image, by default). The //text// parameter also serves for accelerator "hot" key definition. **Events Generated:** | EVENT:Selected | The control has received input focus. | | EVENT:Accepted | The control has been pressed by the user. | | EVENT:PreAlertKey | The user pressed an ALRT attribute hot key. | | EVENT:AlertKey | The user pressed an ALRT attribute hot key. | | EVENT:Drop | A successful drag-and-drop to the control. | **Example:** **MDIChild WINDOW('Child One'),AT(0,0,320,200),MDI,MAX,HVSCROLL** **          BUTTON('1'),AT(0,0,20,20),USE(?B1)** **          BUTTON('2'),AT(20,0,20,20),USE(?B2),KEY(F10Key)** **          BUTTON('3'),AT(40,0,20,20),USE(?B3),MSG('Button 3')** **          BUTTON('4'),AT(60,0,20,20),USE(?B4),HLP('Button4Help')** **          BUTTON('5'),AT(80,0,20,20),USE(?B5),STD(STD:Cut)** **          BUTTON('6'),AT(100,0,20,20),USE(?B6),FONT('Arial',12)** **          BUTTON('7'),AT(120,0,20,20),USE(?B7),ICON(ICON:Question)** **          BUTTON('8'),AT(140,0,20,20),USE(?B8),DEFAULT** **          BUTTON('9'),AT(160,0,20,20),USE(?B9),IMM** **          BUTTON('10'),AT(180,0,20,20),USE(?B10),CURSOR(CURSOR:Wait)** **          BUTTON('11'),AT(200,0,20,20),USE(?B11),REQ** **          BUTTON('12'),AT(220,0,20,20),USE(?B12),ALRT(F10Key)** **          BUTTON('13'),AT(240,0,20,20),USE(?B13),SCROLL** **         END** ** CODE** ** OPEN(MDIChild)** ** ACCEPT** **  CASE ACCEPTED()** **  OF ?B1** **   !Perform some action** **  END** ** END** **See Also:** [[check.htm|CHECK]] [[option declare a set of radio controls .htm|OPTION]] [[radio declare a radio button control .htm|RADIO]]