telmob Posted July 10, 2011 Share Posted July 10, 2011 I've searched the forums, and the closest i found remoted to 2008, so... i'm asking if there's a younger alternative. How can i hide a group and everything inside it? Could i use something like this? $groupgroup1=$Grup1, $Combo1, $Label1, $Combo2, $Label2, $Date1, $Label3, $Combo3 GuiCtrlSetState($groupgroup1,$GUI_HIDE) I know this specific code doesn't work, but is there an alternative? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 10, 2011 Moderators Share Posted July 10, 2011 (edited) telmob,First, you need to understand how the ControlIDs are allocated. AutoIt has an internal array which holds the data for all the controls created by the native (GUICtrlCreate*) functions. The ControlID returned by these functions is actually the index of this array in which the details of the control are stored. AutoIt always looks for the first empty element of this array to use for the next created control. Now to your question. If you create the controls $Grup1, $Combo1, $Label1, $Combo2, $Label2, $Date1, $Label3, $Combo3 in IMMEDIATE SUCCESSION, and no controls created earlier have been deleted, the ControlIDs of these controls should be in a single block. So you can use something like this to hide them:For $i = $Grup1 To $Combo3 GUICtrlSetState($i, $GUI_HIDE) NextBe aware that this is a trick - there is no guarantee that it will always be true in future releases - although I believe it will be because a lot of us depend on it! And it will only be true if no controls created earlier have been deleted (unless you recreate the same number of controls immediately). I hope that is clear - please ask if not. M23Edit: Typnig! Edited July 10, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
telmob Posted July 10, 2011 Author Share Posted July 10, 2011 WOW! This is actually much better than i expected. This way i can put other controls on top of these, and hide them to show these again and so on. Amazing trick! Thank you Melba23! You're the GUI master! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 10, 2011 Moderators Share Posted July 10, 2011 telmob,This way i can put other controls on top of these, and hide them to show these again and so onAlways a good idea to create all the controls initially if you want to use this trick - that way there are no holes in the array! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
telmob Posted July 10, 2011 Author Share Posted July 10, 2011 I just connected 3 different GUIs and hid the 2nd and 3rd part of the gui, until i press a button to show the 2nd gui and another button to show the 3rd gui, works just perfect. I'm loving AutoIt. Link to comment Share on other sites More sharing options...
taietel Posted July 10, 2011 Share Posted July 10, 2011 Melba23, THANKS!!! I didn't thought it was that simple! Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 10, 2011 Moderators Share Posted July 10, 2011 taietel, My pleasure - as always! And I have some ground to make up after the tab thread the other day! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MrBeatnik Posted July 28, 2011 Share Posted July 28, 2011 I thought I would just chime in on this... To avoid the issue noted above where you may delete controls before these ones, you can create your controls in an array instead. This can also solve the issue where your controls may be created on the fly (or not in order).Dim $userArray[5] $userArray[0] = GUICtrlCreateGroup("User Info", 264, 8, 233, 281) $userArray[1] = GUICtrlCreateLabel("User Name", 280, 40, 63, 17) $userArray[2] = GUICtrlCreateInput("John", 360, 40, 121, 21) $userArray[3] = GUICtrlCreateLabel("User Age", 280, 104, 66, 17) $userArray[4] = GUICtrlCreateInput("42", 360, 104, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) For $i = 0 To UBound($roomGroupArray)-1 GUICtrlSetState ( $roomGroupArray[$i], $GUI_HIDE ) NextI don't know if there are any issues with this method (I haven't noted them) - I'd appreciate a reply if anyone knows of any such problems.The only thing is you lose logical naming of the controls - i.e. instead of a control called "$lblUserName", it's called "$userArray[1]" Please correct me if I am wrong in any of my posts. I like learning from my mistakes too. Link to comment Share on other sites More sharing options...
martin Posted July 28, 2011 Share Posted July 28, 2011 (edited) I thought I would just chime in on this... To avoid the issue noted above where you may delete controls before these ones, you can create your controls in an array instead. This can also solve the issue where your controls may be created on the fly (or not in order). Dim $userArray[5] $userArray[0] = GUICtrlCreateGroup("User Info", 264, 8, 233, 281) $userArray[1] = GUICtrlCreateLabel("User Name", 280, 40, 63, 17) $userArray[2] = GUICtrlCreateInput("John", 360, 40, 121, 21) $userArray[3] = GUICtrlCreateLabel("User Age", 280, 104, 66, 17) $userArray[4] = GUICtrlCreateInput("42", 360, 104, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) For $i = 0 To UBound($roomGroupArray)-1 GUICtrlSetState ( $roomGroupArray[$i], $GUI_HIDE ) Next I don't know if there are any issues with this method (I haven't noted them) - I'd appreciate a reply if anyone knows of any such problems. The only thing is you lose logical naming of the controls - i.e. instead of a control called "$lblUserName", it's called "$userArray[1]" The method is fine IMO. If there is an issue with the names as you suggest then there is no reason why you can't have both $BtnQuit = GuiCtrlCreateButton(... $Actrl[0] = $BtnQuit then when you want to refer to an individual control and make it obvious what you're doing use BtnQuit, and when you need to group them use the array. My prefered method is $grp1Start = 0 enum $Grp1 $BtnQuit=0 $ChkNever,..,$Ed1,$grp2Start enum $Grp2 $BtnSave=$grp2Start, $BtnNext,...., $grp3Start etc Global $aCtrls[20] ;create the ctrls in any order you want. ;if you need another control in an existing group just add it in the enum list somewhere. $aCtrls[$BtnNext] = GuiCtrlCreate..... ;then to deal with a group for $n = $grp2Start to $Grp3Start - 1 something($aCtrls{$n]) next which gives the understanding and flexibility, though it needs more planning. It doesn't work so well if you are using Koda though. Edited July 28, 2011 by martin Xandy 1 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...
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