DefPushButton Control

Purpose

Creates a default push button control in the current active form, window, or dialog.

Syntax

DefPushbutton text$, id%, x, y, width, height[, style%]

text$:control text
id%:control identifier
x,y,b,h:iexp
style%:the control styles

Description

The control is a small rectangle with a bold outline that represents the default response for the user. The given text is displayed inside the button. The control highlights the button in the usual way when the user clicks the mouse in it and sends a message to its parent window.

style Specifies the control styles. This value can be a combination of the following styles: BS_DEFPUSHBUTTON, WS_TABSTOP, WS_GROUP, and WS_DISABLED. If you do not specify a style, the default style is BS_DEFPUSHBUTTON | WS_TABSTOP.

The command creates a control without an OCX wrapper; so it and cannot be handled using properties, methods, and event subs. When used in a form the WM_COMMAND and WM_NOTIFY messages should be handled in the form's _Message sub.

Example

Dlg 3D On

Local x%

Dialog # 1, 10, 10, 310, 170, "Name of the dialog"

DefPushButton "&OK", IDOK, 10, 10, 280, 120

EndDialog

ShowDialog # 1

Do : Sleep : Until Dlg_1 Is Nothing

Dlg 3D Off

 

Sub Dlg_1_Message(hWnd%, Mess%, wParam%, lParam%)

If Mess% = WM_COMMAND And wParam% = IDOK Then CloseDialog # 1

EndSub

Remarks

This command is particular useful for a dialog box in a GLL, because a GLL doesn't support OCX controls.

With the general Control statement any control type can be created.

See Also

Control, AnimateCtrl, AutoCheckBox, AutoRadioButton, CheckBox, ComboBox, CText, Dialog, DefPushButton, EditText, GroupBox, HeaderCtrl, ListBox, ListViewCtrl, LText, ProgressCtrl, PushButton, RadioButton, RichEditCtrl, RText, ScrollBar, StatusCtrl, TabCtrl, ToolBarCtrl, TrackBarCtrl, TreeViewCtrl, UpDownCtrl

{Created by Sjouke Hamstra; Last updated: 28/09/2014 by James Gaite}