| 1 | ; AutoIt GUI Example |
|---|
| 2 | ; Created: 17/01/2005 - CyberSlug |
|---|
| 3 | ; Modifed: 05/12/2011 - guinness |
|---|
| 4 | |
|---|
| 5 | #Region INCLUDE |
|---|
| 6 | #include <AVIConstants.au3> |
|---|
| 7 | #include <GuiConstantsEx.au3> |
|---|
| 8 | #include <TreeViewConstants.au3> |
|---|
| 9 | #EndRegion INCLUDE |
|---|
| 10 | |
|---|
| 11 | #Region GUI |
|---|
| 12 | GUICreate("Sample GUI", 400, 400) |
|---|
| 13 | GUISetIcon(@SystemDir & "\mspaint.exe", 0) |
|---|
| 14 | #EndRegion GUI |
|---|
| 15 | |
|---|
| 16 | #Region MENU |
|---|
| 17 | Local $hMenu1 = GUICtrlCreateMenu("Menu &One") |
|---|
| 18 | Local $hMenu2 = GUICtrlCreateMenu("Menu &Two") |
|---|
| 19 | GUICtrlCreateMenu("Menu Th&ree") |
|---|
| 20 | GUICtrlCreateMenu("Menu &Four") |
|---|
| 21 | GUICtrlCreateMenuItem('SubMenu One &A',$hMenu1) |
|---|
| 22 | GUICtrlCreateMenuItem('SubMenu One &B',$hMenu1) |
|---|
| 23 | #EndRegion MENU |
|---|
| 24 | |
|---|
| 25 | #Region CONTEXT MENU |
|---|
| 26 | Local $idContextMenu = GUICtrlCreateContextMenu() |
|---|
| 27 | GUICtrlCreateMenuItem("Context Menu", $idContextMenu) |
|---|
| 28 | GUICtrlCreateMenuItem("", $idContextMenu) ; Separator |
|---|
| 29 | GUICtrlCreateMenuItem("&Properties", $idContextMenu) |
|---|
| 30 | #EndRegion CONTEXT MENU |
|---|
| 31 | |
|---|
| 32 | #Region PIC |
|---|
| 33 | GUICtrlCreatePic("logo4.gif", 0, 0, 169, 68) |
|---|
| 34 | GUICtrlSetTip(-1, '#Region PIC') |
|---|
| 35 | GUICtrlCreateLabel("Sample Pic", 75, 1, 53, 15) |
|---|
| 36 | GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) |
|---|
| 37 | GUICtrlSetColor(-1, 0xFFFFFF) |
|---|
| 38 | #EndRegion PIC |
|---|
| 39 | |
|---|
| 40 | #Region AVI |
|---|
| 41 | GUICtrlCreateAvi("SampleAVI.avi", 0, 180, 10, 32, 32, $ACS_AUTOPLAY) |
|---|
| 42 | GUICtrlSetTip(-1, '#Region AVI') ; TODO |
|---|
| 43 | GUICtrlCreateLabel("Sample avi", 175, 50) |
|---|
| 44 | GUICtrlSetTip(-1, '#Region AVI - Label') |
|---|
| 45 | #EndRegion AVI |
|---|
| 46 | |
|---|
| 47 | #Region TAB |
|---|
| 48 | GUICtrlCreateTab(240, 0, 150, 70) |
|---|
| 49 | GUICtrlCreateTabItem("One") |
|---|
| 50 | GUICtrlSetTip(-1, '#Region TAB1') |
|---|
| 51 | GUICtrlCreateLabel("Sample Tab with TabItems", 250, 40) |
|---|
| 52 | GUICtrlCreateTabItem("Two") |
|---|
| 53 | GUICtrlSetTip(-1, '#Region TAB2') |
|---|
| 54 | GUICtrlCreateTabItem("Three") |
|---|
| 55 | GUICtrlSetTip(-1, '#Region TAB3') |
|---|
| 56 | GUICtrlCreateTabItem("") |
|---|
| 57 | #EndRegion TAB |
|---|
| 58 | |
|---|
| 59 | #Region COMBO |
|---|
| 60 | GUICtrlCreateCombo("Sample Combo", 250, 80, 120, 100) |
|---|
| 61 | GUICtrlSetTip(-1, '#Region COMBO') |
|---|
| 62 | #EndRegion COMBO |
|---|
| 63 | |
|---|
| 64 | #Region PROGRESS |
|---|
| 65 | GUICtrlCreateProgress(60, 80, 150, 20) |
|---|
| 66 | GUICtrlSetTip(-1, '#Region PROGRES') |
|---|
| 67 | GUICtrlSetData(-1, 60) |
|---|
| 68 | GUICtrlCreateLabel("Progress:", 5, 82) |
|---|
| 69 | GUICtrlSetTip(-1, '#Region PROGRES - Label') |
|---|
| 70 | #EndRegion PROGRESS |
|---|
| 71 | |
|---|
| 72 | #Region EDIT |
|---|
| 73 | GUICtrlCreateEdit(@CRLF & " Sample Edit Control", 10, 110, 150, 70) |
|---|
| 74 | GUICtrlSetTip(-1, '#Region EDIT') |
|---|
| 75 | #EndRegion EDIT |
|---|
| 76 | |
|---|
| 77 | #Region LIST |
|---|
| 78 | GUICtrlCreateList("", 5, 190, 100, 90) |
|---|
| 79 | GUICtrlSetTip(-1, '#Region LIST') |
|---|
| 80 | GUICtrlSetData(-1, "A.Sample|B.List|C.Control|D.Here", "B.List") |
|---|
| 81 | #EndRegion LIST |
|---|
| 82 | |
|---|
| 83 | #Region ICON |
|---|
| 84 | GUICtrlCreateIcon("explorer.exe", 0, 175, 120) |
|---|
| 85 | GUICtrlSetTip(-1, '#Region ICON') |
|---|
| 86 | GUICtrlCreateLabel("Icon", 180, 160, 50, 20) |
|---|
| 87 | GUICtrlSetTip(-1, '#Region ICON - Label') |
|---|
| 88 | #EndRegion ICON |
|---|
| 89 | |
|---|
| 90 | #Region LIST VIEW |
|---|
| 91 | Local $idListView = GUICtrlCreateListView("Sample|ListView|", 110, 190, 110, 80) |
|---|
| 92 | GUICtrlSetTip(-1, '#Region LIST VIEW') |
|---|
| 93 | GUICtrlCreateListViewItem("A|One", $idListView) |
|---|
| 94 | GUICtrlCreateListViewItem("B|Two", $idListView) |
|---|
| 95 | GUICtrlCreateListViewItem("C|Three", $idListView) |
|---|
| 96 | #EndRegion LIST VIEW |
|---|
| 97 | |
|---|
| 98 | #Region GROUP WITH RADIO BUTTONS |
|---|
| 99 | GUICtrlCreateGroup("Sample Group", 230, 120) |
|---|
| 100 | GUICtrlCreateRadio("Radio One", 250, 140, 80) |
|---|
| 101 | GUICtrlSetTip(-1, '#Region GROUP WITH RADIO BUTTONS- RADIO1') |
|---|
| 102 | GUICtrlSetState(-1, $GUI_CHECKED) |
|---|
| 103 | GUICtrlCreateRadio("Radio Two", 250, 165, 80) |
|---|
| 104 | GUICtrlSetTip(-1, '#Region GROUP WITH RADIO BUTTONS- RADIO2') |
|---|
| 105 | GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group |
|---|
| 106 | #EndRegion GROUP WITH RADIO BUTTONS |
|---|
| 107 | |
|---|
| 108 | #Region UPDOWN |
|---|
| 109 | GUICtrlCreateLabel("UpDown", 350, 115) |
|---|
| 110 | GUICtrlSetTip(-1, '#Region UPDOWN - Label') |
|---|
| 111 | GUICtrlCreateInput("42", 350, 130, 40, 20) |
|---|
| 112 | GUICtrlSetTip(-1, '#Region UPDOWN - Input') |
|---|
| 113 | GUICtrlCreateUpdown(-1) |
|---|
| 114 | GUICtrlSetTip(-1, '#Region UPDOWN - Updown') |
|---|
| 115 | #EndRegion UPDOWN |
|---|
| 116 | |
|---|
| 117 | #Region LABEL |
|---|
| 118 | GUICtrlCreateLabel("Green" & @CRLF & "Label", 350, 165, 40, 40) |
|---|
| 119 | GUICtrlSetTip(-1, '#Region LABEL') |
|---|
| 120 | GUICtrlSetBkColor(-1, 0x00FF00) |
|---|
| 121 | #EndRegion LABEL |
|---|
| 122 | |
|---|
| 123 | #Region SLIDER |
|---|
| 124 | GUICtrlCreateLabel("Slider:", 235, 215) |
|---|
| 125 | GUICtrlSetTip(-1, '#Region SLIDER - Label') |
|---|
| 126 | GUICtrlCreateSlider(270, 210, 120, 30) |
|---|
| 127 | GUICtrlSetTip(-1, '#Region SLIDER') |
|---|
| 128 | GUICtrlSetData(-1, 30) |
|---|
| 129 | #EndRegion SLIDER |
|---|
| 130 | |
|---|
| 131 | #Region INPUT |
|---|
| 132 | GUICtrlCreateInput("Sample Input Box", 235, 255, 130, 20) |
|---|
| 133 | GUICtrlSetTip(-1, '#Region INPUT') |
|---|
| 134 | #EndRegion INPUT |
|---|
| 135 | |
|---|
| 136 | #Region DATE |
|---|
| 137 | GUICtrlCreateDate("", 5, 280, 200, 20) |
|---|
| 138 | GUICtrlSetTip(-1, '#Region DATE') |
|---|
| 139 | GUICtrlCreateLabel("(Date control expands into a calendar)", 10, 305, 200, 20) |
|---|
| 140 | GUICtrlSetTip(-1, '#Region DATE - Label') |
|---|
| 141 | #EndRegion DATE |
|---|
| 142 | |
|---|
| 143 | #Region BUTTON |
|---|
| 144 | GUICtrlCreateButton("Sample Button", 10, 330, 100, 30) |
|---|
| 145 | GUICtrlSetTip(-1, '#Region BUTTON') |
|---|
| 146 | #EndRegion BUTTON |
|---|
| 147 | |
|---|
| 148 | #Region CHECKBOX |
|---|
| 149 | GUICtrlCreateCheckbox("Checkbox", 130, 335, 80, 20) |
|---|
| 150 | GUICtrlSetTip(-1, '#Region CHECKBOX') |
|---|
| 151 | GUICtrlSetState(-1, $GUI_CHECKED) |
|---|
| 152 | #EndRegion CHECKBOX |
|---|
| 153 | |
|---|
| 154 | #Region TREEVIEW ONE |
|---|
| 155 | Local $idTreeView_1 = GUICtrlCreateTreeView(210, 290, 80, 80) |
|---|
| 156 | GUICtrlSetTip(-1, '#Region TREEVIEW ONE') |
|---|
| 157 | Local $idTreeItem = GUICtrlCreateTreeViewItem("TreeView", $idTreeView_1) |
|---|
| 158 | GUICtrlCreateTreeViewItem("Item1", $idTreeItem) |
|---|
| 159 | GUICtrlCreateTreeViewItem("Item2", $idTreeItem) |
|---|
| 160 | GUICtrlCreateTreeViewItem("Foo", -1) |
|---|
| 161 | GUICtrlSetState($idTreeItem, $GUI_EXPAND) |
|---|
| 162 | #EndRegion TREEVIEW ONE |
|---|
| 163 | |
|---|
| 164 | #Region TREEVIEW TWO |
|---|
| 165 | Local $idTreeView_2 = GUICtrlCreateTreeView(295, 290, 103, 80, $TVS_CHECKBOXES) |
|---|
| 166 | GUICtrlSetTip(-1, '#Region TREEVIEW TWO') |
|---|
| 167 | GUICtrlCreateTreeViewItem("TreeView", $idTreeView_2) |
|---|
| 168 | GUICtrlCreateTreeViewItem("With", $idTreeView_2) |
|---|
| 169 | GUICtrlCreateTreeViewItem("$TVS_CHECKBOXES", $idTreeView_2) |
|---|
| 170 | GUICtrlSetState(-1, $GUI_CHECKED) |
|---|
| 171 | GUICtrlCreateTreeViewItem("Style", $idTreeView_2) |
|---|
| 172 | #EndRegion TREEVIEW TWO |
|---|
| 173 | |
|---|
| 174 | #Region GUI MESSAGE LOOP |
|---|
| 175 | GUISetState(@SW_SHOW) |
|---|
| 176 | While 1 |
|---|
| 177 | Switch GUIGetMsg() |
|---|
| 178 | Case $GUI_EVENT_CLOSE |
|---|
| 179 | Exit |
|---|
| 180 | |
|---|
| 181 | EndSwitch |
|---|
| 182 | WEnd |
|---|
| 183 | #EndRegion GUI MESSAGE LOOP |
|---|