BigDaddyO Posted May 26, 2005 Posted May 26, 2005 Is there any way to have all the controls in a GUI to be disabled by default? I have a large gui with 64 gui controls on it and I need them all to be disabled on GUI load. once the user performs an action I would enable only the specific controls the user needs. I know I can set each control disabled manually with guictrlsetstate but That is a whole lot of code. Thanks, Mike
jpm Posted May 26, 2005 Posted May 26, 2005 Is there any way to have all the controls in a GUI to be disabled by default? I have a large gui with 64 gui controls on it and I need them all to be disabled on GUI load. once the user performs an action I would enable only the specific controls the user needs. I know I can set each control disabled manually with guictrlsetstate but That is a whole lot of code.Thanks,Mike<{POST_SNAPBACK}>No, You need A GuiCtrlSetState(-1, $GUI_DISABLE) after each creation as You did I imagine.
BigDaddyO Posted May 26, 2005 Author Posted May 26, 2005 No, You need A GuiCtrlSetState(-1, $GUI_DISABLE) after each creation as You did I imagine. <{POST_SNAPBACK}>Thanks for the fast reply.I was afraid I would have to do it that way. Well, time to warm up the copy and paste keys...
quick_sliver007 Posted May 26, 2005 Posted May 26, 2005 Is there any way to have all the controls in a GUI to be disabled by default? I have a large gui with 64 gui controls on it and I need them all to be disabled on GUI load. once the user performs an action I would enable only the specific controls the user needs. I know I can set each control disabled manually with guictrlsetstate but That is a whole lot of code.Thanks,Mike<{POST_SNAPBACK}>Also you could just wait to make the controls. Just start the gui with out controls and then later on make the controls. .
falconv Posted May 27, 2005 Posted May 27, 2005 If they're numbered, you could create a For Next statement perhaps. I don't have time to try one out for you now, but try it and let me know how it goes. Also, if you do have to do a lot of Copy/Paste, try out this nice little script (change the keys if you prefer, or if they conflict with the programs you use) I created for when I had to do nearly 200 pages worth of copy/paste: HotKeySet( "{Esc}", "MyExit" ) HotKeySet( "{F3}", "Copy" ) HotKeySet( "{F2}", "Paste" ) HotKeySet( "{F1}", "AltTab" ) HotKeySet( "{F4}", "Cut" ) While 1 WEnd Exit Func MyExit() Exit EndFunc Func Copy() Send( "^c" ) EndFunc Func Paste() Send( "^v" ) EndFunc Func Cut() Send( "^x" ) EndFunc Func AltTab() Send( "!{Tab}" ) EndFunc It helps, more so if you're copying from one window to another, but it will still ease your pain for something like this.
DaleHohm Posted May 27, 2005 Posted May 27, 2005 Is there any way to have all the controls in a GUI to be disabled by default? I have a large gui with 64 gui controls on it and I need them all to be disabled on GUI load. once the user performs an action I would enable only the specific controls the user needs. I know I can set each control disabled manually with guictrlsetstate but That is a whole lot of code.Thanks,Mike<{POST_SNAPBACK}>I'm usually willing to do a bunch of thinking work to avoid busy work... I did something similar recently and wrote a script to create the script I wanted with loops to do the busy work. Perhaps this will give you some ideas:expandcollapse popup#include <Date.au3> $maxt = 3 $maxc = 4 $maxr = 7 $mainGuiHeight = 330 $mainGuiWidth = 400 $tabHeight = 200 $tabWidth = 400 $consoleHeight = 100 $consoleWidth = 400 $file = FileOpen("HotKeys-GUI.au3", 2) FileWriteLine($file, '; File Generated by ' & @ScriptName & ' ' & _Now()) FileWriteLine($file, "") FileWriteLine($file, "#region Create GUI and primary controls") FileWriteLine($file, 'opt("GUICoordMode", 1)') FileWriteLine($file, 'Dim $hGUI = GUICreate("HotKeys", ' & $mainGuiWidth & ', ' & $mainGuiHeight & '); Create main GUI Window') FileWriteLine($file, 'Dim $tab = GUICtrlCreateTab(0, 0, ' & $tabWidth & ', ' & $tabHeight & '); Create the tab control') FileWriteLine($file, 'Dim $console = GUICtrlCreateEdit ("", 0,' & $tabHeight & ' ,' & $consoleWidth & ', ' & $consoleHeight & ',$ES_AUTOVSCROLL+$WS_VSCROLL+$ES_READONLY); Create Console Log Window') FileWriteLine($file, "") FileWriteLine($file, "#endregion") FileWriteLine($file, "#region Create Tabs and Buttons") For $t = 1 To $maxt FileWriteLine($file, 'Opt("GUICoordMode", 1)') FileWriteLine($file, 'Dim $tab' & $t & ' = ' & 'GUICtrlCreateTabitem ("-empty-")') For $c = 1 To $maxc For $r = 1 To $maxr $str = '$tab' & $t & 'col' & $c & 'row' & $r If ($c = 1 And $r = 1) Then FileWriteLine($file, 'Dim ' & $str & ' = ' & 'GUICtrlCreateButton("' & $str & '", 0, 25, 100)') FileWriteLine($file, 'Opt("GUICoordMode", 2)') ElseIf $r = 1 Then FileWriteLine($file, 'Dim ' & $str & ' = ' & 'GUICtrlCreateButton("' & $str & '", 0, -' & 25 * $maxr & ', 0)') Else FileWriteLine($file, 'Dim ' & $str & ' = ' & 'GUICtrlCreateButton("' & $str & '", -1, 0, 0)') EndIf Next Next Next FileWriteLine($file, "") FileWriteLine($file, 'GUICtrlCreateTabitem (""); end tabitem definition') FileWriteLine($file, "#endregion") FileWriteLine($file, "#region Hide Buttons") For $t = 1 To $maxt For $c = 1 To $maxc For $r = 1 To $maxr $str = '$tab' & $t & 'col' & $c & 'row' & $r FileWriteLine($file, 'GUICtrlSetState(' & $str & ', $GUI_HIDE)') Next Next FileWriteLine($file, "") Next FileWriteLine($file, "#endregion") FileWriteLine($file, "#region Create application buttons") FileWriteLine($file, 'opt("GUICoordMode", 1)') FileWriteLine($file, 'Dim $hClipboard = GUICtrlCreateButton("Copy to Clipboard", 0, ' & $mainGuiHeight - 27 & ', 100)') FileWriteLine($file, 'Dim $hClear = GUICtrlCreateButton("Clear", 100, ' & $mainGuiHeight - 27 & ', 50)') FileWriteLine($file, 'Dim $hClose = GUICtrlCreateButton("Close", ' & $mainGuiWidth - 50 & ', ' & $mainGuiHeight - 27 & ', 50)') FileWriteLine($file, "") FileWriteLine($file, 'GUICtrlSetOnEvent($hClipboard, "ConsoleToClipboard")') FileWriteLine($file, 'GUICtrlSetOnEvent($hClear, "ClearConsole")') FileWriteLine($file, 'GUICtrlSetOnEvent($hClose, "Close")') FileWriteLine($file, "") FileWriteLine($file, 'GUISetState(@SW_SHOW)') FileWriteLine($file, "") FileWriteLine($file, "Func ActivateTab($t, $l)") FileWriteLine($file, " ; $t - handle of tab") FileWriteLine($file, " ; $l - label to use for tab") FileWriteLine($file, " GUICtrlSetData($t, $l)") FileWriteLine($file, "EndFunc ;==>ActivateTab") FileWriteLine($file, "") FileWriteLine($file, "Func ActivateButton($b, $l, $cb)") FileWriteLine($file, " ; $b - handle of button") FileWriteLine($file, " ; $l - label to place on button") FileWriteLine($file, " ; $cb - name of callback function to call when button is pressed (don't include '()' at the end of function name)") FileWriteLine($file, " GUICtrlSetData($b, $l)") FileWriteLine($file, " GUICtrlSetOnEvent($b, $cb)") FileWriteLine($file, " GUICtrlSetState($b, $GUI_SHOW)") FileWriteLine($file, "EndFunc ;==>ActivateButton") FileWriteLine($file, "") FileWriteLine($file, "Func LogToConsole($s)") FileWriteLine($file, " Dim $o") FileWriteLine($file, " $o = GUICtrlRead($console)") FileWriteLine($file, " $s = $o & _Now() & ', ' & $s & @CRLF") FileWriteLine($file, " GUICtrlSetData($console, $s)") FileWriteLine($file, "EndFunc ;==>LogToConsole") FileWriteLine($file, "") FileWriteLine($file, "Func ClearConsole($s)") FileWriteLine($file, " GUICtrlSetData($console, '')") FileWriteLine($file, " LogToConsole('Console Log cleared')") FileWriteLine($file, "EndFunc ;==>ClearConsole") FileWriteLine($file, "") FileWriteLine($file, "Func ConsoleToClipboard()") FileWriteLine($file, " ClipPut(GUICtrlRead($console))") FileWriteLine($file, " LogToConsole('Console Log contents copied to clipboard')") FileWriteLine($file, "EndFunc ;==>ConsoleToClipboard") FileWriteLine($file, "") FileWriteLine($file, "Func Close()") FileWriteLine($file, " Exit") FileWriteLine($file, "EndFunc ;==>Close") Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
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