User Tools

Site Tools


toolbutton

ToolButton (QToolButton)

The Qt documentation in C++ of this class can be read here: http://doc.trolltech.com/4.4/qtoolbutton.html

A control for the form object, provides a push button looking as tool button.

Most important

Methods None
Properties Icon
Events OnEvent

Please read the control class overview Control as well.

PROPERTIES

Checkable

Property Checkable As Boolean (ReadWrite)

If it is true, the CommandButton appears as checkable button. If you would like to group several buttons as auto-exclusive group, set for all buttons the same group name.


Checked

Property Checked As Boolean (ReadWrite)

If it is true, the CommandButton is checked.


Icon

Property Icon As String (ReadWrite)

Either an icon or caption is visible on a CommandButton. If you set an icon, the caption will not be displayed. An icon can be an absolute path to an image file (png, jpg,…) like c:\myfolder\myimage.png or can be an relative path to the current project like myimage.png (which is present in the current project directory). Relative paths are recommended.

Might be a String containing binary data. See the binary project example for using.

Example

Dim c As ToolButton
c = Control("Button1") ' Button1 is declared as CommandButton in this form
c.Icon = "tux.jpg" ' relative path. File exists in current project directory

Key

Property Key As String (ReadWrite)

Holds the information, which key press would raise the event connected to this CommandButton, e.g. Ctrl+O. The strings “Ctrl”, “Shift”, “Alt” and “Meta” are recognized.

Example

Shift+L
Alt+U
Alt+Shift+U
Ctrl+Alt+C

Copy

Default keys are

HelpContentsOpen help contents
WhatsThisActivate whats this.
OpenOpen Document.
CloseClose Document/Tab.
SaveSave Document.
NewCreate new Document.
DeleteDelete.
CutCut.
CopyCopy.
PastePaste.
UndoUndo.
RedoRedo.
BackNavigate back.
ForwardNavigate forward.
RefreshRefresh or reload current document.
ZoomInZoom in.
ZoomOutZoom out.
PrintPrint document.
AddTabAdd new tab.
NextChildNavigate to next tab or child window.
PreviousChildNavigate to previous tab or child window.
FindFind in document.
FindNextFind next result.
FindPreviousFind previous result.
ReplaceFind and replace.
SelectAllSelect all text.
BoldBold text.
ItalicItalic text.
UnderlineUnderline text.
MoveToNextCharMove cursor to next character.
MoveToPreviousCharMove cursor to previous character.
MoveToNextWordMove cursor to next word.
MoveToPreviousWordMove cursor to previous word.
MoveToNextLineMove cursor to next line.
MoveToPreviousLineMove cursor to previous line.
MoveToNextPageMove cursor to next page.
MoveToPreviousPageMove cursor to previous page.
MoveToStartOfLineMove cursor to start of line.
MoveToEndOfLineMove cursor to end of line.
MoveToStartOfBlockMove cursor to start of a block. This shortcut is only used on OS X.
MoveToEndOfBlockMove cursor to end of block. This shortcut is only used on the OS X.
MoveToStartOfDocumentMove cursor to start of document.
MoveToEndOfDocumentMove cursor to end of document.
SelectNextCharExtend selection to next character.
SelectPreviousCharExtend selection to previous character.
SelectNextWordExtend selection to next word.
SelectPreviousWordExtend selection to previous word.
SelectNextLineExtend selection to next line.
SelectPreviousLineExtend selection to previous line.
SelectNextPageExtend selection to next page.
SelectPreviousPageExtend selection to previous page.
SelectStartOfLineExtend selection to start of line.
SelectEndOfLineExtend selection to end of line.
SelectStartOfBlockExtend selection to the start of a text block. This shortcut is only used on OS X.
SelectEndOfBlockExtend selection to the end of a text block. This shortcut is only used on OS X.
SelectStartOfDocumentExtend selection to start of document.
SelectEndOfDocumentExtend selection to end of document.
DeleteStartOfWordDelete the beginning of a word up to the cursor.
DeleteEndOfWordDelete word from the end of the cursor.
DeleteEndOfLine

Caption

Property Caption As String (ReadWrite)

Holds the text to be displayed on the CommandButton.

Example

Dim c As CommandButton
c = FormControl("Button1") ' Button1 is declared as CommandButton in this form
c.Caption = "Hello World!"

If you want the commandbutton to respond to key inputs, set the property Key. The character ”&” is used to underline the key the next character. Double ”&&” shows one ”&” in the caption.

See also Icon


Text

Property Text As String (ReadWrite)

Same as Caption. Provided for easy-use.


Value

Property Value As String (ReadWrite)

Same as Caption. Provided for easy-use.


Not implemented yet:

AutoRepeat ( bool ) AutoRepeatDelay ( int ) AutoRepeatInterval ( int )

EVENTS

OnEvent

Sub OnEvent()

This event is raised, whenever the user presses the ToolButton, either by mouse or key.

Example

Sub Button1_OnEvent()
  Print "Button1 pressed"
End Sub

toolbutton.txt · Last modified: 2013/04/09 22:58 (external edit)