1 | #include <GuiToolbar.au3> |
---|
2 | #include <GuiConstantsEx.au3> |
---|
3 | #include <WindowsConstants.au3> |
---|
4 | #include <Constants.au3> |
---|
5 | |
---|
6 | Opt('MustDeclareVars', 1) |
---|
7 | |
---|
8 | $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work |
---|
9 | Global $iMemo |
---|
10 | |
---|
11 | _Main() |
---|
12 | |
---|
13 | Func _Main() |
---|
14 | Local $hGUI, $hToolbar, $aStrings[4] |
---|
15 | Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp |
---|
16 | |
---|
17 | ; Create GUI |
---|
18 | $hGUI = GUICreate("Toolbar", 400, 300) |
---|
19 | $hToolbar = _GUICtrlToolbar_Create($hGUI) |
---|
20 | $iMemo = GUICtrlCreateEdit("", 2, 60, 396, 238, $WS_VSCROLL) |
---|
21 | ; $iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL) |
---|
22 | GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New") |
---|
23 | GUISetState() |
---|
24 | |
---|
25 | ; Add standard system bitmaps |
---|
26 | Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar) |
---|
27 | Case 0 |
---|
28 | _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) |
---|
29 | Case 2 |
---|
30 | _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) |
---|
31 | EndSwitch |
---|
32 | |
---|
33 | ; Add strings |
---|
34 | $aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New") |
---|
35 | $aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open") |
---|
36 | $aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save") |
---|
37 | $aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help") |
---|
38 | |
---|
39 | ; Add buttons |
---|
40 | _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0]) |
---|
41 | _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1]) |
---|
42 | _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2]) |
---|
43 | _GUICtrlToolbar_AddButtonSep ($hToolbar) |
---|
44 | _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3]) |
---|
45 | |
---|
46 | ; Change Save button text |
---|
47 | _GUICtrlToolbar_SetButtonText($hToolbar, $idSave, "&Close") |
---|
48 | |
---|
49 | ; Show Save button text |
---|
50 | MemoWrite("Save button text: " & _GUICtrlToolbar_GetButtonText($hToolbar, $idSave)) |
---|
51 | |
---|
52 | |
---|
53 | ; Loop until user exits |
---|
54 | Do |
---|
55 | Until GUIGetMsg() = $GUI_EVENT_CLOSE |
---|
56 | |
---|
57 | EndFunc ;==>_Main |
---|
58 | |
---|
59 | ; Write message to memo |
---|
60 | Func MemoWrite($sMessage = "") |
---|
61 | GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) |
---|
62 | EndFunc ;==>MemoWrite |
---|