Wb-FreeKill 0 Posted March 31, 2005 Is there an easier and faster way to do this, cuz when you have about 10 of these in a loop, to hide/show the different buttons when you select a menu in the TREEVIEW.. every time you select a new TreeviewItem, it have to hide all the other buttons form the previus, can i do it in a better way @ less cpu usage? Func PressList() If $msg = $generalitem Then GUICtrlSetState($LogEdit,$GUI_HIDE) GUICtrlSetState($FilesLogEdit,$GUI_HIDE) For $i = 1 to 14 GUICtrlSetState ($Shutdwn[$i],$GUI_HIDE) Next For $i = 0 to 14 GUICtrlSetState ($Windowmng[$i],$GUI_HIDE) Next For $i = 1 to 13 GUICtrlSetState ($Mousemng[$i],$GUI_HIDE) Next For $i = 1 to 12 GUICtrlSetState ($MessageBoxes[$i],$GUI_HIDE) Next For $i = 1 to 20 GUICtrlSetState ($OtherStuff[$i],$GUI_HIDE) Next For $i = 1 to 14 GUICtrlSetState ($InternetX[$i],$GUI_HIDE) Next For $i = 1 to 6 GUICtrlSetState ($chat[$i],$GUI_HIDE) Next For $i = 1 to 15 GUICtrlSetState ($h1[$i],$GUI_HIDE) Next For $i = 1 to 15 GUICtrlSetState ($1[$i],$GUI_HIDE) Next EndIf EndFunc Share this post Link to post Share on other sites
kjactive 1 Posted March 31, 2005 (edited) Dam lots of controls - well normally I would do like this as an example... Put all control IDs into a multidimentional array like this Group[Control group,2,3... etc.][the Controls,2,3,4... etc.] Then put in the splitter variable into a string like $split = 14 14 13 12 20....etc. and split it into an array with... $sp = StringSplit($splitter) then you got the spot to split to a new array as $sp[1] would be the first target etc... FOR $a = 1 FOR 11 // 11 groups FOR $b = 1 TO $sp[$a] GUICtrlSetState (Group[$a][$b],$GUI_HIDE) Next Next Well something like this would do... Kåre Edited March 31, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Share this post Link to post Share on other sites
Wb-FreeKill 0 Posted March 31, 2005 Hey Kåre, i see your from copenhagen too well, im from Amager.. nice to see Danish people in here! I understand what you explained, but not exatcly how to do it.. i se the structure in it, but this: FOR $a = 1 FOR 11 // 11 groups FOR $b = 1 TO $sp[$a] Confuses me Share this post Link to post Share on other sites
kjactive 1 Posted April 1, 2005 (edited) Hallå well I keep on in english, Naa it was just an example and I was not that correct... $split = 14 14 13 12 20....etc // How many controls in the rows as string then AutoIt has a nice 'split it up into array' function... $sp = StringSplit($split,' ') // here you split 14 14 13 12 20... into $sp[] with a blank character as delimiter... $sp[1] = 14 and $sp[3] = 13 etc. Then this would be... FOR $a = 1 FOR $sp[0] // $sp[0] = 11 groups starting as $a = 1 FOR $b = 1 TO $sp[$a] // FOR 1 TO 14 as $a was one - 2 3 4...etc. GUICtrlSetState (Group[$a][$b],$GUI_HIDE) // this hold Control IDs Next Next Actually I would put this into a function and make $GUI_HIDE as an argument then one can do the HIDE / SHOW to all the controls from just one same function well every action on the controls can then be done from just this one function... Very tight code but I hope you got the point as there are just too many controls in your example to do a script for you... Kåre Edited April 1, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Share this post Link to post Share on other sites
Lazycat 13 Posted April 1, 2005 I think this can be done a bit simpler. Dim $Group[11][21]; 20 - max controls + 1 as end marker For $a = 0 To 10; 11 groups $b = 0 While $Group[$a][$b] > 0; Until first zero item (marker) GUICtrlSetState (Group[$a][$b],$GUI_HIDE) $b = $b + 1 Wend Next Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Share this post Link to post Share on other sites
Wb-FreeKill 0 Posted April 12, 2005 Okay, im taking this tread up again, because theres something dont understand how to do.. I'm aware of this, and how it works: Dim $Group[11][21]; 20 - max controls + 1 as end marker For $a = 0 To 10; 11 groups $b = 0 While $Group[$a][$b] > 0; Until first zero item (marker) GUICtrlSetState (Group[$a][$b],$GUI_HIDE) $b = $b + 1 Wend Next But how to i group the control to use in this func? Share this post Link to post Share on other sites
zcoacoaz 0 Posted April 12, 2005 What about putting all the controls in a child GUI and hiding the GUI instead? [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Share this post Link to post Share on other sites
Wb-FreeKill 0 Posted April 12, 2005 What about putting all the controls in a child GUI and hiding the GUI instead?<{POST_SNAPBACK}>that would work, if i would like nice when a gui is in a gui.. Share this post Link to post Share on other sites
zcoacoaz 0 Posted April 12, 2005 heres an example expandcollapse popup#include <guiconstants.au3> $Screen = 1 $Main = GUICreate ( "Child Example", 400, 400 ) $Menu = GUICtrlCreateList ( "", 0, 0, 100, 400 ) GUICtrlSetData ( -1, "Screen1|Screen2|Screen3", "Screen1" ) GUISetState ( ) $First = GUICreate ( "Screen 1", 300, 400, 100, 0, $WS_CHILD, -1, $Main ) GUICtrlCreateButton ( "Screen 1 Button", 100, 100, 100, 25 ) GUISetState ( ) $Second = GUICreate ( "Screen 2", 300, 400, 100, 0, $WS_CHILD, -1, $Main ) GUICtrlCreateButton ( "Screen 2 Button", 200, 100, 75, 20 ) GUICtrlCreateLabel ( "Hello!!!", 5, 5, 100, 20 ) GUISetState ( ) $Third = GUICreate ( "Screen 3", 300, 400, 100, 0, $WS_CHILD, -1, $Main ) GUICtrlCreateButton ( "Screen 3 Button", 0, 0, 50, 25 ) GUICtrlCreateCombo ( "Combo", 50, 75, 100, 20 ) GUISetState ( ) Do Sleep ( 10 ) $Data = GUICtrlRead ( $Menu ) If $Data = "Screen1" And Not ( $Screen = 1 ) Then $Screen = 1 GUISetState ( @SW_SHOW, $First ) GUISetState ( @SW_HIDE, $Second ) GUISetState ( @SW_HIDE, $Third ) ElseIf $Data = "Screen2" And Not ( $Screen = 2 ) Then $Screen = 2 GUISetState ( @SW_HIDE, $First ) GUISetState ( @SW_SHOW, $Second ) GUISetState ( @SW_HIDE, $Third ) ElseIf $Data = "Screen3" And Not ( $Screen = 3 ) Then $Screen = 3 GUISetState ( @SW_HIDE, $First ) GUISetState ( @SW_HIDE, $Second ) GUISetState ( @SW_SHOW, $Third ) EndIf Until GUIGetMsg ( ) = -3 [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Share this post Link to post Share on other sites
Wb-FreeKill 0 Posted April 12, 2005 okay ive maked something similr, and it works much better, thx! Share this post Link to post Share on other sites