GUISetAccelerators Sets the accelerator table to be used in a GUI window.. winhandle [optional] Windows handle as returned by GUICreate default is the previously used window.. The array
Trang 1GUISetAccelerators
Sets the accelerator table to be used in a GUI window
GUISetAccelerators ( accelerators [, winhandle] )
Parameters
accelerators A 2 dimensional array holding the accelerator table (See remarks) winhandle [optional] Windows handle as returned by GUICreate (default is the
previously used window)
Return Value
Success: Returns 1
Failure: Returns 0
Remarks
The array passed to this function contains the hotkey and the control ID of the accelerator The array must be defined as Dim $array[n][2] - where n is the number
of accelerator keys to set:
$array[0][0] = Hotkey (in HotKeySet() format) of 1st accelerator
$array[0][1] = Control ID of the 1st accelerator, as returned by GUICtrlCreate ()
$array[1][0] = Hotkey of 2nd accelerator
$array[1][1] = Control ID of the 2nd accelerator
$array[n][0] = Hotkey of nth accelerator
$array[n][1] = Control ID of the nth accelerator
Passing this function a non-array will unset all accelerators for the given
winhandle
Related
Trang 2GUICreate, HotKeySet
Example
; A simple custom messagebox that uses the MessageLoop mode
#include <GUIConstantsEx.au3>
GUICreate("Custom Msgbox", 210, 80)
GUICtrlCreateLabel("Please click a button!", 10, 10)
$YesID = GUICtrlCreateButton("Yes", 10, 50, 50, 20)
$NoID = GUICtrlCreateButton("No", 80, 50, 50, 20)
$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
; Set accelerators for Ctrl+y and Ctrl+n
Dim $AccelKeys[2][2]=[["^y", $YesID], ["^n", $NoID]]
GUISetAccelerators($AccelKeys)
GUISetState() ; display the GUI
Do
$msg = GUIGetMsg()
Select
Case $msg = $YesID
MsgBox(0, "You clicked on", "Yes")
Case $msg = $NoID
MsgBox(0, "You clicked on", "No")
Case $msg = $ExitID
MsgBox(0, "You clicked on", "Exit")
Case $msg = $GUI_EVENT_CLOSE
MsgBox(0, "You clicked on", "Close")
EndSelect
Until $msg = $GUI_EVENT_CLOSE Or $msg = $ExitID
Trang 3Function Reference
GUISetBkColor
Sets the background color of the GUI window
GUISetBkColor ( background [, winhandle] )
Parameters
background Background color of the dialog box
winhandle [optional] Windows handle as returned by GUICreate (default is the
previously used window)
Return Value
Success: Returns 1
Failure: Returns 0
Remarks
Earlier versions of AutoIt (prior to v3.0.102) used the BGR format for defining color - newer versions use RGB by default but this can be changed using the ColorMode option
Related
ColorMode (Option), GUICreate
Example
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Trang 4Example()
Func Example()
Local $msg
GUICreate("My GUI") ; will create a dialog box that when displayed is centered
GUISetBkColor(0xE0FFFF) ; will change background color
GUISetState() ; will display an empty dialog box
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example
Function Reference
GUISetCoord
Sets absolute coordinates for the next control
GUISetCoord ( left, top [, width [, height [, winhandle]]] )
Parameters
left The left side of the control
top The top of the control
width [optional] The width of the control (default is the previously used
width)
Trang 5height [optional] The height of the control (default is the previously used
height)
winhandle [optional] Windows handle as returned by GUICreate (default is the
previously used)
Return Value
Success: Returns 1
Failure: Returns 0
Remarks
To be used specifically in Opt ("GUICoordMode", 2) It allows you to set the current position to a precise point and from that position to create controls by row (x_offset,-1) or by columns (-1, y_offset)
Related
GUICtrlCreate
Example
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $msg
Opt("GUICoordMode", 2) ; relative to cell mode
Trang 6GUICreate("My GUI Set Coord", 200, 100) GUICtrlCreateCheckbox("Check #1", 20, 10, 75)