Ealric Posted May 2, 2008 Share Posted May 2, 2008 (edited) NOTE: This is in a very basic stage but you can get an idea of how it works. I know that KODA is a part of Scite and is a solid form designer but I wanted to try working on creating something similar in autoit. I love working with command line consoles so most of the work I wanted to implement through input commands. However, once controls are created, you can manipulate them and move them with the mouse. Eventually, I'll add a build button and it will build the code for the GUI you've designed. Download the autoit logo graphic Place the script in the same directory as the graphic Run the code expandcollapse popup#cs ---------------------------------------------------------------------------- Author: Ealric Version: 1.0 #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <Misc.au3> Opt("MouseCoordMode", 0) Const $RGN_AND = 1 Const $RGN_OR = 2 Const $RGN_XOR = 3 Const $RGN_DIFF = 4 Const $RGN_COPY = 5 $dll = DllOpen("user32.dll") Global $title = "PDT" Global $version = "1.0.0" Global $gAvi[100], $gButton[100], $gCheckbox[100], $gCombo[100], $gContextMenu[100] Global $gDate[100], $gDummy[100], $gEdit[100], $gGraphic[100], $gGroup[100] Global $gIcon[100], $gInput[100], $gLabel[100], $gList[100], $gListView[100] Global $gListViewItem[100], $gMenu[100], $gMenuItem[100], $gMonthCal[100], $gObj[100] Global $gPic[100], $gProgress[100], $gRadio[100], $gSlider[100], $gTab[100] Global $gTabItem[100], $gTreeView[100], $gTreeViewItem[100], $gUpdown[100], $gDelete[100] Global $pGUI,$templabel, $guititle, $guiwidth, $guiheight Global $iX, $iY Global $gcreate = 0 Global $step[10] Global $xoffset = 37 Global $yoffset = 23 Global $wposx, $wposy, $DT, $cWIN, $xcalcL, $xcalcR, $ycalc, $cpos, $pos, $tpos, $hexV For $y = 0 To 9 $step[$y] = 0 Next Global $gParent = GUICreate($title, @DesktopWidth, @DesktopHeight, -1, -1, $WS_EX_ACCEPTFILES + $WS_POPUP + $WS_EX_TRANSPARENT + $WS_EX_TOPMOST) GUISetBkColor(0x000000, $gParent) GUICtrlCreatePic(@ScriptDir & "\au3_new.jpg", 10, 10, 240, 100) $gL1 = GUICtrlCreateLabel("Programmer's Desktop", @DesktopWidth / 2 - 60, 20, 120, 15) _textcolor($gL1) $gL2 = GUICtrlCreateLabel("AU3:\>", 50, @DesktopHeight - 50, 40, 20) _textcolor($gL2) $inp1 = GUICtrlCreateInput("", 90, @DesktopHeight - 53, 400, 20) _controlcolor($inp1) _textcolor($inp1) GUISetState() HotKeySet("{END}", "Terminate") HotKeySet("{ENTER}", "_enter") ; ## Clear Globals _clearvars() While 1 Sleep(0030) $msg = GUIGetMsg() For $i = 0 To 99 Switch $msg #cs AVI cases follow below. #ce Case $gAvi[$i] ; Not Implemented yet #cs Button cases follow below. #ce Case $gButton[$i] GUISwitch($pGUI) $step[0] = 0 While 1 _MGP($msg) If _IsPressed("01", $dll) Then ExitLoop EndIf WEnd _mwiggle($msg) _MouseTrap() GUISwitch($gParent) ControlFocus ("","",$gParent) EndSwitch Next WEnd Func _textcolor($cID) GUICtrlSetColor($cID, 0xFFFFFF) EndFunc ;==>_textcolor Func _controlcolor($cID) GUICtrlSetBkColor($cID, 0x000000) EndFunc ;==>_controlcolor Func _enter() Local $gREAD = GUICtrlRead($inp1) GUICtrlSetData($inp1, "", "") _buildcommand($gREAD) EndFunc ;==>_enter Func _buildcommand($command) Switch $command Case "avi" ; ### AVI ### MsgBox(0, "GuiCtrlCreate", "avi not implemented yet.", 2) Case "button" ; ### BUTTON ### If $gcreate = 1 Then For $i = 0 To 99 If $gButton[$i] = "" Then $set = $i ExitLoop EndIf Next _label("Enter Button Text") HotKeySet("{ENTER}", "_return") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then Local $BTNTitle = GUICtrlRead($inp1) ; Button Title is set GUICtrlSetData($inp1, "", "") $step[0] = 1 EndIf Until $step[0] = 1 $step[0] = 0 GUICtrlDelete($templabel) _label("Enter LEFT Number") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used Local $BTNLeft = GUICtrlRead($inp1) ; Button TOP is set GUICtrlSetData($inp1, "", "") $step[1] = 1 Else MsgBox(48, "Error", "The Button LEFT must be an integer.", 1) EndIf EndIf Until $step[1] = 1 $step[1] = 0 GUICtrlDelete($templabel) _label("Enter TOP Number") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used Local $BTNTop = GUICtrlRead($inp1) ; Button TOP is set GUICtrlSetData($inp1, "", "") $step[2] = 1 Else MsgBox(48, "Error", "The Button TOP must be an integer.", 1) EndIf EndIf Until $step[2] = 1 $step[2] = 0 GUICtrlDelete($templabel) GUISwitch($pGUI) $gButton[$set] = GUICtrlCreateButton($BTNTitle, $BTNLeft, $BTNTop) Else MsgBox(48, "Create a GUI", "Use the (create) command to create a GUI first", 3) EndIf HotKeySet("{ENTER}", "_enter") Case "checkbox" ; ### CHECKBOX ### MsgBox(0, "GuiCtrlCreate", "checkbox not implemented yet.", 2) Case "combo" ; ### COMBO ### MsgBox(0, "GuiCtrlCreate", "combo not implemented yet.", 2) Case "contextmenu" MsgBox(0, "GuiCtrlCreate", "contextmenu not implemented yet.", 2) Case "create" If $gcreate = 0 Then _label("Enter GUI Title") HotKeySet("{ENTER}", "_return") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then $guititle = GUICtrlRead($inp1) ; Gui Title is set GUICtrlSetData($inp1, "", "") $step[0] = 1 EndIf Until $step[0] = 1 $step[0] = 0 GUICtrlDelete($templabel) _label("Enter GUI Width") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used $guiwidth = GUICtrlRead($inp1) ; Gui Width is set GUICtrlSetData($inp1, "", "") $step[1] = 1 Else MsgBox(48, "Error", "The GUI Width must be an integer.", 1) EndIf EndIf Until $step[1] = 1 $step[1] = 0 GUICtrlDelete($templabel) _label("Enter GUI Height") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used $guiheight = GUICtrlRead($inp1) ; Gui Height is set GUICtrlSetData($inp1, "", "") $step[2] = 1 Else MsgBox(48, "Error", "The GUI Height must be an integer.", 1) EndIf EndIf Until $step[2] = 1 $step[2] = 0 GUICtrlDelete($templabel) $iX = @DesktopWidth / 2 - $guiwidth / 2 ; true X coords of GUI $iY = @DesktopHeight / 2 - $guiheight / 2 ; true Y coords of GUI Local $GUILABEL = GUICtrlCreateLabel($guititle, $iX + 20, $iY - 20) _textcolor($GUILABEL) _GuiHole($gParent, $iX, $iY, $guiwidth, $guiheight) $pGUI = GUICreate($guititle,$guiwidth,$guiheight,-1,-1,$WS_POPUP) GUISetState(@SW_SHOW,$pGUI) GUISwitch($gParent) ControlFocus ("","",$gParent) $gcreate = 1 Else MsgBox(0, "", "Child GUIs are not currently supported", 2) EndIf HotKeySet("{ENTER}", "_enter") Case "date" MsgBox(0, "GuiCtrlCreate", "date not implemented yet.", 2) Case "dummy" MsgBox(0, "GuiCtrlCreate", "dummy not implemented yet.", 2) Case "edit" MsgBox(0, "GuiCtrlCreate", "edit not implemented yet.", 2) Case "graphic" MsgBox(0, "GuiCtrlCreate", "graphic not implemented yet.", 2) Case "group" MsgBox(0, "GuiCtrlCreate", "group not implemented yet.", 2) Case "icon" MsgBox(0, "GuiCtrlCreate", "icon not implemented yet.", 2) Case "input" MsgBox(0, "GuiCtrlCreate", "input not implemented yet.", 2) Case "label" MsgBox(0, "GuiCtrlCreate", "label not implemented yet.", 2) Case "list" MsgBox(0, "GuiCtrlCreate", "list not implemented yet.", 2) Case "listview" MsgBox(0, "GuiCtrlCreate", "listview not implemented yet.", 2) Case "menu" MsgBox(0, "GuiCtrlCreate", "menu not implemented yet.", 2) Case "menuitem" MsgBox(0, "GuiCtrlCreate", "menuitem not implemented yet.", 2) Case "monthcal" MsgBox(0, "GuiCtrlCreate", "monthcal not implemented yet.", 2) Case "obj" MsgBox(0, "GuiCtrlCreate", "obj not implemented yet.", 2) Case "pic" MsgBox(0, "GuiCtrlCreate", "pic not implemented yet.", 2) Case "progress" MsgBox(0, "GuiCtrlCreate", "progress not implemented yet.", 2) Case "radio" MsgBox(0, "GuiCtrlCreate", "radio not implemented yet.", 2) Case "slider" MsgBox(0, "GuiCtrlCreate", "slider not implemented yet.", 2) Case "tab" MsgBox(0, "GuiCtrlCreate", "tab not implemented yet.", 2) Case "tabitem" MsgBox(0, "GuiCtrlCreate", "tabitem not implemented yet.", 2) Case "treeview" MsgBox(0, "GuiCtrlCreate", "treeview not implemented yet.", 2) Case "treeviewitem" MsgBox(0, "GuiCtrlCreate", "treeviewitem not implemented yet.", 2) Case "updown" MsgBox(0, "GuiCtrlCreate", "updown not implemented yet.", 2) Case "delete" MsgBox(0, "GuiCtrlCreate", "delete not implemented yet.", 2) EndSwitch EndFunc ;==>_buildcommand Func _return() Return EndFunc ;==>_return Func _clear($var) For $i = 0 To 99 $var[$i] = "" Next EndFunc ;==>_clear Func _mwiggle($msg) $cpos = MouseGetPos() MouseMove($cpos[0] - 10, $cpos[1]) Sleep(0030) ;Local $var = ControlGetPos("", "", $msg) ;MsgBox(0,"",$var[0]&" ,"&$var[1]&" ,"&$var[2]&" ,"&$var[3]) GUICtrlSetData($inp1,"","") EndFunc ;==>_mwiggle Func _clearvars() _clear($gAvi) _clear($gButton) _clear($gCheckbox) _clear($gCombo) _clear($gContextMenu) _clear($gDate) _clear($gDummy) _clear($gEdit) _clear($gGraphic) _clear($gGroup) _clear($gIcon) _clear($gInput) _clear($gLabel) _clear($gList) _clear($gListView) _clear($gListViewItem) _clear($gMenu) _clear($gMenuItem) _clear($gMonthCal) _clear($gObj) _clear($gPic) _clear($gProgress) _clear($gRadio) _clear($gSlider) _clear($gTab) _clear($gTabItem) _clear($gTreeView) _clear($gTreeViewItem) _clear($gUpdown) _clear($gDelete) EndFunc ;==>_clearvars Func _label($lmsg) $templabel = GUICtrlCreateLabel($lmsg, 110, @DesktopHeight - 70, 150, 15) _textcolor($templabel) EndFunc ;==>_label Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh) Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn $pos = WinGetPos($h_win) $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3]) $inner_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_sizew, "long", $i_y + $i_sizeh) $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", $RGN_DIFF) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1) EndFunc Func _MGP($cID) Sleep(0010) $coords = WinGetPos($pGUI) _MouseTrap($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3]) $pos = MouseGetPos() GUICtrlSetPos($cID, $pos[0], $pos[1]) ; Move the control EndFunc ;==>_MGP Func Terminate() DllClose($dll) Exit 0 EndFunc ;==>Terminate As a test platform, here's what you can do: CODEType "create" and follow the prompts to create your initial GUI. After the GUI is created, type "button" to create a generic button. Left click on the control with your mouse and move it. Left click again to place it. Do this as often as you like. Type "button" again and create another button. Create as many buttons as you like. To end the GUI mode, just press the "END" key. That will terminate it. Or, rightclick on the tray icon. The purpose of releasing this early on is to fix any issues and to receive feedback on design and implementation. I'm also hoping that somewhere in the code as I progress, someone else can utilize or learn something. Thanks.apd.rar Edited May 2, 2008 by Ealric My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic] Link to comment Share on other sites More sharing options...
martin Posted May 2, 2008 Share Posted May 2, 2008 NOTE: This is in a very basic stage but you can get an idea of how it works. I know that KODA is a part of Scite and is a solid form designer but I wanted to try working on creating something similar in autoit. I love working with command line consoles so most of the work I wanted to implement through input commands. However, once controls are created, you can manipulate them and move them with the mouse. Eventually, I'll add a build button and it will build the code for the GUI you've designed. Download the autoit logo graphic Place the script in the same directory as the graphic Run the code expandcollapse popup#cs ---------------------------------------------------------------------------- Author: Ealric Version: 1.0 #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <Misc.au3> Opt("MouseCoordMode", 0) Const $RGN_AND = 1 Const $RGN_OR = 2 Const $RGN_XOR = 3 Const $RGN_DIFF = 4 Const $RGN_COPY = 5 $dll = DllOpen("user32.dll") Global $title = "PDT" Global $version = "1.0.0" Global $gAvi[100], $gButton[100], $gCheckbox[100], $gCombo[100], $gContextMenu[100] Global $gDate[100], $gDummy[100], $gEdit[100], $gGraphic[100], $gGroup[100] Global $gIcon[100], $gInput[100], $gLabel[100], $gList[100], $gListView[100] Global $gListViewItem[100], $gMenu[100], $gMenuItem[100], $gMonthCal[100], $gObj[100] Global $gPic[100], $gProgress[100], $gRadio[100], $gSlider[100], $gTab[100] Global $gTabItem[100], $gTreeView[100], $gTreeViewItem[100], $gUpdown[100], $gDelete[100] Global $pGUI,$templabel, $guititle, $guiwidth, $guiheight Global $iX, $iY Global $gcreate = 0 Global $step[10] Global $xoffset = 37 Global $yoffset = 23 Global $wposx, $wposy, $DT, $cWIN, $xcalcL, $xcalcR, $ycalc, $cpos, $pos, $tpos, $hexV For $y = 0 To 9 $step[$y] = 0 Next Global $gParent = GUICreate($title, @DesktopWidth, @DesktopHeight, -1, -1, $WS_EX_ACCEPTFILES + $WS_POPUP + $WS_EX_TRANSPARENT + $WS_EX_TOPMOST) GUISetBkColor(0x000000, $gParent) GUICtrlCreatePic(@ScriptDir & "\au3_new.jpg", 10, 10, 240, 100) $gL1 = GUICtrlCreateLabel("Programmer's Desktop", @DesktopWidth / 2 - 60, 20, 120, 15) _textcolor($gL1) $gL2 = GUICtrlCreateLabel("AU3:\>", 50, @DesktopHeight - 50, 40, 20) _textcolor($gL2) $inp1 = GUICtrlCreateInput("", 90, @DesktopHeight - 53, 400, 20) _controlcolor($inp1) _textcolor($inp1) GUISetState() HotKeySet("{END}", "Terminate") HotKeySet("{ENTER}", "_enter") ; ## Clear Globals _clearvars() While 1 Sleep(0030) $msg = GUIGetMsg() For $i = 0 To 99 Switch $msg #cs AVI cases follow below. #ce Case $gAvi[$i] ; Not Implemented yet #cs Button cases follow below. #ce Case $gButton[$i] GUISwitch($pGUI) $step[0] = 0 While 1 _MGP($msg) If _IsPressed("01", $dll) Then ExitLoop EndIf WEnd _mwiggle($msg) _MouseTrap() GUISwitch($gParent) ControlFocus ("","",$gParent) EndSwitch Next WEnd Func _textcolor($cID) GUICtrlSetColor($cID, 0xFFFFFF) EndFunc ;==>_textcolor Func _controlcolor($cID) GUICtrlSetBkColor($cID, 0x000000) EndFunc ;==>_controlcolor Func _enter() Local $gREAD = GUICtrlRead($inp1) GUICtrlSetData($inp1, "", "") _buildcommand($gREAD) EndFunc ;==>_enter Func _buildcommand($command) Switch $command Case "avi" ; ### AVI ### MsgBox(0, "GuiCtrlCreate", "avi not implemented yet.", 2) Case "button" ; ### BUTTON ### If $gcreate = 1 Then For $i = 0 To 99 If $gButton[$i] = "" Then $set = $i ExitLoop EndIf Next _label("Enter Button Text") HotKeySet("{ENTER}", "_return") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then Local $BTNTitle = GUICtrlRead($inp1) ; Button Title is set GUICtrlSetData($inp1, "", "") $step[0] = 1 EndIf Until $step[0] = 1 $step[0] = 0 GUICtrlDelete($templabel) _label("Enter LEFT Number") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used Local $BTNLeft = GUICtrlRead($inp1) ; Button TOP is set GUICtrlSetData($inp1, "", "") $step[1] = 1 Else MsgBox(48, "Error", "The Button LEFT must be an integer.", 1) EndIf EndIf Until $step[1] = 1 $step[1] = 0 GUICtrlDelete($templabel) _label("Enter TOP Number") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used Local $BTNTop = GUICtrlRead($inp1) ; Button TOP is set GUICtrlSetData($inp1, "", "") $step[2] = 1 Else MsgBox(48, "Error", "The Button TOP must be an integer.", 1) EndIf EndIf Until $step[2] = 1 $step[2] = 0 GUICtrlDelete($templabel) GUISwitch($pGUI) $gButton[$set] = GUICtrlCreateButton($BTNTitle, $BTNLeft, $BTNTop) Else MsgBox(48, "Create a GUI", "Use the (create) command to create a GUI first", 3) EndIf HotKeySet("{ENTER}", "_enter") Case "checkbox" ; ### CHECKBOX ### MsgBox(0, "GuiCtrlCreate", "checkbox not implemented yet.", 2) Case "combo" ; ### COMBO ### MsgBox(0, "GuiCtrlCreate", "combo not implemented yet.", 2) Case "contextmenu" MsgBox(0, "GuiCtrlCreate", "contextmenu not implemented yet.", 2) Case "create" If $gcreate = 0 Then _label("Enter GUI Title") HotKeySet("{ENTER}", "_return") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then $guititle = GUICtrlRead($inp1) ; Gui Title is set GUICtrlSetData($inp1, "", "") $step[0] = 1 EndIf Until $step[0] = 1 $step[0] = 0 GUICtrlDelete($templabel) _label("Enter GUI Width") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used $guiwidth = GUICtrlRead($inp1) ; Gui Width is set GUICtrlSetData($inp1, "", "") $step[1] = 1 Else MsgBox(48, "Error", "The GUI Width must be an integer.", 1) EndIf EndIf Until $step[1] = 1 $step[1] = 0 GUICtrlDelete($templabel) _label("Enter GUI Height") Sleep(0500) Do Sleep(0030) If _IsPressed("0D", $dll) Then If StringIsInt(GUICtrlRead($inp1)) = 1 Then ; make sure INT is used $guiheight = GUICtrlRead($inp1) ; Gui Height is set GUICtrlSetData($inp1, "", "") $step[2] = 1 Else MsgBox(48, "Error", "The GUI Height must be an integer.", 1) EndIf EndIf Until $step[2] = 1 $step[2] = 0 GUICtrlDelete($templabel) $iX = @DesktopWidth / 2 - $guiwidth / 2 ; true X coords of GUI $iY = @DesktopHeight / 2 - $guiheight / 2 ; true Y coords of GUI Local $GUILABEL = GUICtrlCreateLabel($guititle, $iX + 20, $iY - 20) _textcolor($GUILABEL) _GuiHole($gParent, $iX, $iY, $guiwidth, $guiheight) $pGUI = GUICreate($guititle,$guiwidth,$guiheight,-1,-1,$WS_POPUP) GUISetState(@SW_SHOW,$pGUI) GUISwitch($gParent) ControlFocus ("","",$gParent) $gcreate = 1 Else MsgBox(0, "", "Child GUIs are not currently supported", 2) EndIf HotKeySet("{ENTER}", "_enter") Case "date" MsgBox(0, "GuiCtrlCreate", "date not implemented yet.", 2) Case "dummy" MsgBox(0, "GuiCtrlCreate", "dummy not implemented yet.", 2) Case "edit" MsgBox(0, "GuiCtrlCreate", "edit not implemented yet.", 2) Case "graphic" MsgBox(0, "GuiCtrlCreate", "graphic not implemented yet.", 2) Case "group" MsgBox(0, "GuiCtrlCreate", "group not implemented yet.", 2) Case "icon" MsgBox(0, "GuiCtrlCreate", "icon not implemented yet.", 2) Case "input" MsgBox(0, "GuiCtrlCreate", "input not implemented yet.", 2) Case "label" MsgBox(0, "GuiCtrlCreate", "label not implemented yet.", 2) Case "list" MsgBox(0, "GuiCtrlCreate", "list not implemented yet.", 2) Case "listview" MsgBox(0, "GuiCtrlCreate", "listview not implemented yet.", 2) Case "menu" MsgBox(0, "GuiCtrlCreate", "menu not implemented yet.", 2) Case "menuitem" MsgBox(0, "GuiCtrlCreate", "menuitem not implemented yet.", 2) Case "monthcal" MsgBox(0, "GuiCtrlCreate", "monthcal not implemented yet.", 2) Case "obj" MsgBox(0, "GuiCtrlCreate", "obj not implemented yet.", 2) Case "pic" MsgBox(0, "GuiCtrlCreate", "pic not implemented yet.", 2) Case "progress" MsgBox(0, "GuiCtrlCreate", "progress not implemented yet.", 2) Case "radio" MsgBox(0, "GuiCtrlCreate", "radio not implemented yet.", 2) Case "slider" MsgBox(0, "GuiCtrlCreate", "slider not implemented yet.", 2) Case "tab" MsgBox(0, "GuiCtrlCreate", "tab not implemented yet.", 2) Case "tabitem" MsgBox(0, "GuiCtrlCreate", "tabitem not implemented yet.", 2) Case "treeview" MsgBox(0, "GuiCtrlCreate", "treeview not implemented yet.", 2) Case "treeviewitem" MsgBox(0, "GuiCtrlCreate", "treeviewitem not implemented yet.", 2) Case "updown" MsgBox(0, "GuiCtrlCreate", "updown not implemented yet.", 2) Case "delete" MsgBox(0, "GuiCtrlCreate", "delete not implemented yet.", 2) EndSwitch EndFunc ;==>_buildcommand Func _return() Return EndFunc ;==>_return Func _clear($var) For $i = 0 To 99 $var[$i] = "" Next EndFunc ;==>_clear Func _mwiggle($msg) $cpos = MouseGetPos() MouseMove($cpos[0] - 10, $cpos[1]) Sleep(0030) ;Local $var = ControlGetPos("", "", $msg) ;MsgBox(0,"",$var[0]&" ,"&$var[1]&" ,"&$var[2]&" ,"&$var[3]) GUICtrlSetData($inp1,"","") EndFunc ;==>_mwiggle Func _clearvars() _clear($gAvi) _clear($gButton) _clear($gCheckbox) _clear($gCombo) _clear($gContextMenu) _clear($gDate) _clear($gDummy) _clear($gEdit) _clear($gGraphic) _clear($gGroup) _clear($gIcon) _clear($gInput) _clear($gLabel) _clear($gList) _clear($gListView) _clear($gListViewItem) _clear($gMenu) _clear($gMenuItem) _clear($gMonthCal) _clear($gObj) _clear($gPic) _clear($gProgress) _clear($gRadio) _clear($gSlider) _clear($gTab) _clear($gTabItem) _clear($gTreeView) _clear($gTreeViewItem) _clear($gUpdown) _clear($gDelete) EndFunc ;==>_clearvars Func _label($lmsg) $templabel = GUICtrlCreateLabel($lmsg, 110, @DesktopHeight - 70, 150, 15) _textcolor($templabel) EndFunc ;==>_label Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh) Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn $pos = WinGetPos($h_win) $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3]) $inner_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_sizew, "long", $i_y + $i_sizeh) $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", $RGN_DIFF) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1) EndFunc Func _MGP($cID) Sleep(0010) $coords = WinGetPos($pGUI) _MouseTrap($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3]) $pos = MouseGetPos() GUICtrlSetPos($cID, $pos[0], $pos[1]) ; Move the control EndFunc ;==>_MGP Func Terminate() DllClose($dll) Exit 0 EndFunc ;==>Terminate As a test platform, here's what you can do: CODEType "create" and follow the prompts to create your initial GUI. After the GUI is created, type "button" to create a generic button. Left click on the control with your mouse and move it. Left click again to place it. Do this as often as you like. Type "button" again and create another button. Create as many buttons as you like. To end the GUI mode, just press the "END" key. That will terminate it. Or, rightclick on the tray icon. The purpose of releasing this early on is to fix any issues and to receive feedback on design and implementation. I'm also hoping that somewhere in the code as I progress, someone else can utilize or learn something. Thanks.This line at the end of the GuiCreat Case looks wrong. ControlFocus ("","",$gParent) You have made a hole in the main gui I suppose so that you can see the new window. This doesn't work very well. If you switch to another app then back to your designer the previous app is behind the hole not the new window. I think it would be better to make the new GUI a child window. You need to remove the Enter key as a HotKey when the user switches to another app or the other apps stop working. Moving the button is unreliable, though I haven't tried to find out why. I would prefer a drag operation rather than a click and move, click and stop. Also, it needs a size-drag feature, but I know it's early days yet. You are very brave to start this project. I wish you luck and fun. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Ealric Posted May 2, 2008 Author Share Posted May 2, 2008 (edited) Thanks for the input Martin! I'll work on it. As there is only one control at the moment in the real parent GUI, the controlfocus will default to the command line using that command. Edited May 2, 2008 by Ealric My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now