Button Interface Reference

The Button control allows the user to push it. More...

Inheritance diagram for Button:

Inheritance graph
Collaboration diagram for Button:

Collaboration graph
List of all members.

Properties

VARIANT_BOOL RW Default []
 The Default property is a Boolean value that indicates that the Button is a default button.
VARIANT_BOOL RW Cancel []
 The Default property is a Boolean value that indicates that the Button is a cancel button.
VARIANT_BOOL RW CommandLinkButton []
 The button will be a command link button that behaves like a normal button, but the command link button has a green arrow on the left pointing to the button text.
BSTR RW Note []
 Sets the text of the note associated with a command link button CommandLinkButton.
VARIANT_BOOL RW Shield []
 Sets the elevation required state for the button to display an elevated icon.

Detailed Description

The Button control allows the user to push it.

When the user clicks the button, the OnClick event occur.

Example:

o = new ActiveXObject("Scripting.WindowSystemObject")

o.EnableVisualStyles = true

f = o.CreateForm(0,0,0,0)

f.Text = "WSO"
f.ClientWidth = 200
f.ClientHeight = 100
f.CenterControl()

Button = f.CreateButton(120,70,75,25,"Close")
Button.OnClick = CloseForm

f.Show()

o.Run()


function CloseForm(Sender)
{
        f.Close()
}

Result:

WindowSystemObject.jpg


Property Documentation

VARIANT_BOOL RW Cancel

The Default property is a Boolean value that indicates that the Button is a cancel button.

See also CancelButton.

When user uses ESC key, the OnClick event of the Cancel button occurs.

Example (JScript):

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 200
f.ClientHeight = 100
f.CenterControl()

button = f.CreateButton(10,10,75,25,"Test")
button.Cancel = true
button.OnClick = function(){
        f.MessageBox("Test")
}

f.CreateEdit(10,40,100,25).SetFocus()

f.TextOut(10,70,"Press Esc")

f.Show()

o.Run()

Note:
The OnClick event can be raised for the button only if its Control::Visible and Control::Enabled is "TRUE".

VARIANT_BOOL RW CommandLinkButton

The button will be a command link button that behaves like a normal button, but the command link button has a green arrow on the left pointing to the button text.

Requires Comctl32.dll version 6. Requires visual styles (Themes). Requires Windows Vista. Without visual styles it will be normal button.

Example (JScript):

o = new ActiveXObject("Scripting.WindowSystemObject")
o.EnableVisualStyles = true

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 500
f.ClientHeight = 300
f.CenterControl()

f.TextOut(10,10,"Command link button example")
f.TextOut(10,40,"Windows Vista and EnableVisualStyles required")

Button = f.CreateButton(10,70,200,55,"Close")
Button.CommandLinkButton = true
Button.OnClick = CloseFormHandler
Button.Note = "Click this to close window"

f.Show()

o.Run()


function CloseFormHandler(Sender)
{
        Sender.Form.Close()
}

Result:

CommandLinkButton.jpg

Since:
1.1.10.

VARIANT_BOOL RW Default

The Default property is a Boolean value that indicates that the Button is a default button.

See also AcceptButton.

When user uses enter key, the OnClick event of the Accept button occurs.

Example (JScript):

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 200
f.ClientHeight = 100
f.CenterControl()

button = f.CreateButton(10,10,75,25,"Test")
button.Default = true
button.OnClick = function(){
        f.MessageBox("Test")
}

f.CreateEdit(10,40,100,25).SetFocus()

f.TextOut(10,70,"Press Enter")

f.Show()

o.Run()

Note:
The OnClick event can be raised for the button only if its Control::Visible and Control::Enabled is "TRUE".

BSTR RW Note

Sets the text of the note associated with a command link button CommandLinkButton.

Requires visual styles (Themes). This can be used only if CommandLinkButton = "TRUE".

Since:
1.1.10.

VARIANT_BOOL RW Shield

Sets the elevation required state for the button to display an elevated icon.

Requires visual styles (Themes). Requires Comctl32.dll version 6.

Since:
1.1.10.


WSO 1.1 Documentation. Date modified:Wed Aug 12 18:12:18 2015. (C) Veretennikov A. B. 2004-2015