Moderators Melba23 Posted February 27, 2011 Author Moderators Share Posted February 27, 2011 Lupo73,The error indicates that the small disabled label that the UDF uses to locate the sections is no longer present and so the ControlGetPos in Line 417 is failing. I can see nothing in the code you posted which might delete it - and the GUI extends and retracts normally when I remove the GUI from the function and run it separately:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIExtender.au3> Global $mCurrentType = "", $mCombo_TypeData = "|A|B|C" $mGUI = GUICreate("Test", 300, 330, -1, -1, -1, $WS_EX_TOOLWINDOW, WinGetHandle(AutoItWinGetTitle())) _GUIExtender_Init($mGUI) ; Section 1 _GUIExtender_Section_Start(0, 180) GUICtrlCreateLabel('DESCRIPTION' & ":", 10, 10, 160, 20) $mInput_Name = GUICtrlCreateInput("FileName", 10, 31, 278, 20) ;GUICtrlSetTip($mInput_Name, __Lang_Get('MANAGE_EDIT_TIP_0', 'Choose a description for this association.')) GUICtrlCreateLabel('MANAGE_PATTERN_RULE' & ":", 10, 60 + 10, 160, 20) $mInput_Rule = GUICtrlCreateInput("Input_RuleData", 10, 60 + 31, 200, 20) ;GUICtrlSetTip($mInput_Rule, __Lang_Get('MANAGE_EDIT_TIP_1', 'Write a pattern rule for this association.')) $mButton_Rule = GUICtrlCreateButton('INFO', 10 + 208, 60 + 30, 70, 22) GUICtrlCreateLabel('MANAGE_ACTION' & ":", 10, 120 + 10, 160, 20) $mCombo_Type = GUICtrlCreateCombo("", 10, 120 + 31, 200, 24, 0x0003) ; $mButton_Type = GUICtrlCreateButton(__Lang_Get('INFO', 'Info'), 10 + 208, 120 + 30, 70, 22) _GUIExtender_Section_Action(2, "Less", "More", 10 + 208, 120 + 30, 70, 22, 1) _GUIExtender_Section_End() ; Section 2 _GUIExtender_Section_Start(180, 40) GUICtrlCreateButton('INFO', 10, 180, 70, 22) ; <<<<<<<<<<<<<<<<< test _GUIExtender_Section_End() ; Section 3 _GUIExtender_Section_Start(220, 100) $mDestination_Label = GUICtrlCreateLabel('MANAGE_DESTINATION_FOLDER' & ":", 10, 220 + 10, 160, 20) $mInput_Directory = GUICtrlCreateInput("Directory", 10, 220 + 31, 200, 20) ;GUICtrlSetTip($mInput_Directory, __Lang_Get('MANAGE_EDIT_TIP_2', 'As destination are supported both absolute and relative paths.')) $mButton_Directory = GUICtrlCreateButton('SEARCH', 10 + 208, 220 + 30, 70, 22) If $mCurrentType == 'EXCLUDE' Or $mCurrentType == 'DELETE' Then GUICtrlSetData($mInput_Directory, 'EMPTY') GUICtrlSetState($mInput_Directory, $GUI_DISABLE) GUICtrlSetState($mButton_Directory, $GUI_DISABLE) ElseIf $mCurrentType == 'OPEN_WITH' Then GUICtrlSetData($mDestination_Label, 'MANAGE_DESTINATION_PROGRAM' & ":") EndIf GUICtrlSetData($mCombo_Type, $mCombo_TypeData, $mCurrentType) $mSave = GUICtrlCreateButton("&" & 'SAVE', 150 - 20 - 76, 290, 76, 26) GUICtrlSetState($mSave, 144) ; Disable Save Button Initially. $mCancel = GUICtrlCreateButton("&" & 'CANCEL', 150 + 20, 290, 76, 26) GUICtrlSetState($mCancel, 576) _GUIExtender_Section_End() _GUIExtender_Section_Extend(0, False) GUISetState(@SW_SHOW) ControlClick($mGUI, "", $mInput_Name) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIExtender_Action($iMsg) WEndDo you have any code in the functions you are calling in the While...WEnd loop which deletes a range of controls in $mGUI? If you want to post the whole thing I would be happy to take a look. 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...
Moderators Melba23 Posted February 27, 2011 Author Moderators Share Posted February 27, 2011 Lupo73, Sorry, our posts crossed. Are you saying that you get the same behaviour with the simple script you posted a few minutes ago? Because when I run this it works perfectly and I can operate all the extend/retract buttons as often as I like without error. 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...
Lupo73 Posted February 27, 2011 Share Posted February 27, 2011 (edited) The problem is similar, even if not at the same line. This is my procedure to replicate the error with the second code: 1. start the script 2. click "Test" button 3. close the opened child window (that use your udf) 4. click "Test" button again (it produces the error, in this case at line 387) This is the console stamp: C:\Users\Lupo\Desktop\GUIExtender\GUIExtender.au3 (387) : ==> Subscript used with non-Array variable.: $iAdjust_Y = $aPos[1] - $iNext_Coord $iAdjust_Y = $aPos^ ERROR Note: I think the problem happens only if your udf is used for child windows Edited February 27, 2011 by Lupo73 SFTPEx, AutoCompleteInput, _DateTimeStandard(), _ImageWriteResize(), _GUIGraduallyHide(): some AutoIt functions. Lupo PenSuite: all-in-one and completely free selection of portable programs and games. DropIt: a personal assistant to automatically manage your files. ArcThemALL!: application to multi-archive your files and folders. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 27, 2011 Author Moderators Share Posted February 27, 2011 Lupo73,OK, I see the problem - the UDF was not designed to be used by more than one GUI in the same script and so the second time you create a GUI using the UDF it is corrupting the array in which the UDF stores its data. I will add another function to the UDF to reset this array as the GUI is deleted - then you can reload the child as often as you wish. Thanks for finding this - expect the new release some time tomorow. 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...
Lupo73 Posted February 27, 2011 Share Posted February 27, 2011 Great! I think it will be an useful update for many other users! SFTPEx, AutoCompleteInput, _DateTimeStandard(), _ImageWriteResize(), _GUIGraduallyHide(): some AutoIt functions. Lupo PenSuite: all-in-one and completely free selection of portable programs and games. DropIt: a personal assistant to automatically manage your files. ArcThemALL!: application to multi-archive your files and folders. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 28, 2011 Author Moderators Share Posted February 28, 2011 New Version 28/02/11Fixed - UDF crashed if reused on a new GUI within the same script - the data array was corrupted when the new GUI was created. An example of this would be the deletion and recreation of a child GUI with extendable sections. (Thanks Lupo73 )A new function _GUIExtender_Clear has been added to reset the data array. Call it when a GUI with extendable sections is deleted so that the data array is reset ready for the next GUI to use the UDF. There is a linked code change to _GUIExtender_Init - this will fail if the data array has not been reset, so a check for @error will show the UDF has not been initialised correctly.Note that if you only use the UDF on the main GUI in your script which remains in existence until the script exits, there is no requirement to call the _GUIExtender_Clear function on exit. It is only required if you are destroying and then recreating GUIs which use the UDF within the same script - as in the child example which found the problem. No other syntax changes required.New UDF, new example and zip in first post. 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...
Lupo73 Posted February 28, 2011 Share Posted February 28, 2011 Perfect! Now it works fine! SFTPEx, AutoCompleteInput, _DateTimeStandard(), _ImageWriteResize(), _GUIGraduallyHide(): some AutoIt functions. Lupo PenSuite: all-in-one and completely free selection of portable programs and games. DropIt: a personal assistant to automatically manage your files. ArcThemALL!: application to multi-archive your files and folders. Link to comment Share on other sites More sharing options...
katoNkatoNK Posted June 14, 2011 Share Posted June 14, 2011 Great addition to AutoIt this!! I do have one question.. What handle do I use when using: _GUICtrlIpAddress_Create($hWnd, 145, 125, 135, 20) or would i have to have a seperate action to toggle it? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2011 Author Moderators Share Posted June 14, 2011 katoNkatoNK,You would use the handle of the GUI as normal. But as the IpAddress control is not created by a native AutoIt function, you need to create the control button and handle all the hiding and showing of the control yourself, like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIExtender.au3> #Include <GuiIPAddress.au3> $hGUI = GUICreate("Test", 500, 500) _GUIExtender_Init($hGUI) _GUIExtender_Section_Start(0, 200) GUICtrlCreateLabel("", 0, 0, 500, 200) GUICtrlSetBkColor(-1, 0xFFCCCC) GUICtrlSetState(-1, $GUI_DISABLE) $hToggle = GUICtrlCreateButton("Hide IpAdd", 10, 10, 80, 30) _GUIExtender_Section_End() $iExtSection = _GUIExtender_Section_Start(200, 100) $hIpAdd = _GUICtrlIpAddress_Create($hGUI, 245, 225, 135, 20) _GUIExtender_Section_End() _GUIExtender_Section_Start(300, 200) GUICtrlCreateLabel("", 0, 300, 500, 200) GUICtrlSetBkColor(-1, 0xFFCCCC) _GUIExtender_Section_End() GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hToggle Switch GUICtrlRead($hToggle) Case "Hide IpAdd" ControlHide($hGUI, "", $hIpAdd) _GUIExtender_Section_Extend($iExtSection, False) GUICtrlSetData($hToggle, "Show IpAdd") Case "Show IpAdd" ControlShow($hGUI, "", $hIpAdd) _GUIExtender_Section_Extend($iExtSection) GUICtrlSetData($hToggle, "Hide IpAdd") EndSwitch EndSwitch WEndAll clear? 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...
katoNkatoNK Posted June 14, 2011 Share Posted June 14, 2011 (edited) Yes thank you for the clean example! I re-arranged my setup of the menu-syncing in the loop, from your UDF example: Local $sGUIip_State = _GUIExtender_Section_State($ipSection) If $sGUIip_State = 0 Then If BitAND(GUICtrlRead($vIP), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($vIP, $GUI_UNCHECKED) ControlHide($hGUI, "", $ipAdd) ControlHide($hGUI, "", $Subnet) ControlHide($hGUI, "", $Gateway) ElseIf $sGUIip_State = 1 Then If BitAND(GUICtrlRead($vIP), $GUI_CHECKED) <> $GUI_CHECKED Then GUICtrlSetState($vIP, $GUI_CHECKED) ControlShow($hGUI, "", $ipAdd) ControlShow($hGUI, "", $Subnet) ControlShow($hGUI, "", $Gateway) EndIf Edit: It's that or have a seperate check triggered by the menu item's state. An idea, an array could be parsed to the Extend action with the control handles and then 'automate' it.. Err.. It isn't the best thing to use more than one IP Control with GUIExtender as the position doesn't change with the expanding/retracting.. Edited June 14, 2011 by katoNkatoNK Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2011 Author Moderators Share Posted June 14, 2011 katoNkatoNK, It isn't the best thing to use more than one IP Control with GUIExtender as the position doesn't change with the expanding/retractingThe same would be true of any control that is not created with the native AutoIt commands. The UDF uses ControlIDs to hide/show the controls - UDF-created controls return handles and so the UDF does not know how to deal with them. However, you can use multiple UDF-created controls if you put them all into the same section: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIExtender.au3> #Include <GuiIPAddress.au3> $hGUI = GUICreate("Test", 500, 500) _GUIExtender_Init($hGUI) _GUIExtender_Section_Start(0, 200) GUICtrlCreateLabel("", 0, 0, 500, 200) GUICtrlSetBkColor(-1, 0xFFCCCC) GUICtrlSetState(-1, $GUI_DISABLE) $hToggle = GUICtrlCreateButton("Hide IpAdd", 10, 10, 80, 30) _GUIExtender_Section_End() $iExtSection = _GUIExtender_Section_Start(200, 100) $hIpAdd_1 = _GUICtrlIpAddress_Create($hGUI, 10, 210, 135, 20) $hIpAdd_2 = _GUICtrlIpAddress_Create($hGUI, 166, 210, 135, 20) $hIpAdd_3 = _GUICtrlIpAddress_Create($hGUI, 333, 210, 135, 20) _GUIExtender_Section_End() _GUIExtender_Section_Start(300, 200) GUICtrlCreateLabel("", 0, 300, 500, 200) GUICtrlSetBkColor(-1, 0xFFCCCC) _GUIExtender_Section_End() GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hToggle Switch GUICtrlRead($hToggle) Case "Hide IpAdd" ControlHide($hGUI, "", $hIpAdd_1) ControlHide($hGUI, "", $hIpAdd_2) ControlHide($hGUI, "", $hIpAdd_3) _GUIExtender_Section_Extend($iExtSection, False) GUICtrlSetData($hToggle, "Show IpAdd") Case "Show IpAdd" ControlShow($hGUI, "", $hIpAdd_1) ControlShow($hGUI, "", $hIpAdd_2) ControlShow($hGUI, "", $hIpAdd_3) _GUIExtender_Section_Extend($iExtSection) GUICtrlSetData($hToggle, "Hide IpAdd") EndSwitch EndSwitch WEnd And if you were thinking of asking - I am not going to modify the UDF to be able to cope with UDF-created controls. 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...
katoNkatoNK Posted June 14, 2011 Share Posted June 14, 2011 (edited) Yep, I've gotten that part right for a single section, but i have three consecutive sections with the 'section arrow' as the break between them - and it's terrible trying to get them to display correctly.Here's what i've managed to do:No, i wasn't expecting it Edited June 14, 2011 by katoNkatoNK Link to comment Share on other sites More sharing options...
katoNkatoNK Posted June 14, 2011 Share Posted June 14, 2011 (edited) Hi, Something else i came across.. After the gui is restored from the tray and if all sections have been retracted the controls below the first static section aren't visible. I'm sure this can be avoided? expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <Constants.au3> #include "GUIExtender.au3" Opt('MustDeclareVars', 1) Opt('TrayMenuMode', 3) Opt('TrayAutoPause', 0) Global $hGUI, $iMsg, $tMsg, $View, $tExit, $1, $2, $3 Global $sStatic1, $sStatic2, $sStatic3, $Section1, $Section2, $Section3, $sGUI1, $sGUI2, $sGUI3 $hGUI = GUICreate("hGui", 290, 610, -1, -1) $View = GUICtrlCreateMenu("View") $1 = GUICtrlCreateMenuItem("IP Settings", $View) $2 = GUICtrlCreateMenuItem("DNS Settings", $View) $3 = GUICtrlCreateMenuItem("WINS Settings", $View) _GUIExtender_Init($hGUI) $sStatic1 = _GUIExtender_Section_Start(0, 90) GUICtrlCreateGroup("", 5, 0, 285, 70) GUICtrlCreateCheckbox("IP Address", 35, 75) _GUIExtender_Section_Action($sStatic1 + 1, "", "", 13, 78, 15, 15) _GUIExtender_Section_End() $Section1 = _GUIExtender_Section_Start(90, 140) GUICtrlCreateGroup("", 5, 125, 280, 110) _GUIExtender_Section_End() $sStatic2 = _GUIExtender_Section_Start(230, 25) GUICtrlCreateCheckbox("DNS Servers", 35, 240) _GUIExtender_Section_Action($sStatic2 + 1, "", "", 13, 243, 15, 15) _GUIExtender_Section_End() $Section2 = _GUIExtender_Section_Start(255, 110) GUICtrlCreateGroup("", 5, 290, 280, 80) _GUIExtender_Section_End() $sStatic3 = _GUIExtender_Section_Start(365, 25) GUICtrlCreateCheckbox("WINS Server", 35, 375) _GUIExtender_Section_Action($sStatic3 + 1, "", "", 13, 378, 15, 15) _GUIExtender_Section_End() $Section3 = _GUIExtender_Section_Start(390, 110) GUICtrlCreateGroup("", 5, 425, 280, 80) _GUIExtender_Section_End() _GUIExtender_Section_Start(500, 95) GUIStartGroup() GUICtrlCreateGroup("", 5, 535, 280, 50) GUICtrlCreateRadio("radio1", 15, 510) GUICtrlCreateRadio("radio2:", 15, 530) _GUIExtender_Section_End() _GUIExtender_Section_Extend(0, False) $tExit = TrayCreateItem("Exit") GUISetState(@SW_SHOW, $hGUI) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $1 If BitAND(GUICtrlRead($1), $GUI_CHECKED) = $GUI_CHECKED Then _GUIExtender_Section_Extend($Section1, False) GUICtrlSetState($1, $GUI_UNCHECKED) Else _GUIExtender_Section_Extend($Section1) GUICtrlSetState($1, $GUI_CHECKED) EndIf Case $2 If BitAND(GUICtrlRead($2), $GUI_CHECKED) = $GUI_CHECKED Then _GUIExtender_Section_Extend($Section2, False) GUICtrlSetState($2, $GUI_UNCHECKED) Else _GUIExtender_Section_Extend($Section2) GUICtrlSetState($2, $GUI_CHECKED) EndIf Case $3 If BitAND(GUICtrlRead($3), $GUI_CHECKED) = $GUI_CHECKED Then _GUIExtender_Section_Extend($Section3, False) GUICtrlSetState($3, $GUI_UNCHECKED) Else _GUIExtender_Section_Extend($Section3) GUICtrlSetState($3, $GUI_CHECKED) EndIf Case $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE) TraySetState() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIExtender_Action($iMsg) $sGUI1 = _GUIExtender_Section_State($Section1) $sGUI2 = _GUIExtender_Section_State($Section2) $sGUI3 = _GUIExtender_Section_State($Section3) If $sGUI1 = 0 Then If BitAND(GUICtrlRead($1), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($1, $GUI_UNCHECKED) ElseIf $sGUI1 = 1 Then If BitAND(GUICtrlRead($1), $GUI_CHECKED) <> $GUI_CHECKED Then GUICtrlSetState($1, $GUI_CHECKED) EndIf If $sGUI2 = 0 Then If BitAND(GUICtrlRead($2), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($2, $GUI_UNCHECKED) ElseIf $sGUI2 = 1 Then If BitAND(GUICtrlRead($2), $GUI_CHECKED) <> $GUI_CHECKED Then GUICtrlSetState($2, $GUI_CHECKED) EndIf If $sGUI3 = 0 Then If BitAND(GUICtrlRead($3), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($3, $GUI_UNCHECKED) ElseIf $sGUI3 = 1 Then If BitAND(GUICtrlRead($3), $GUI_CHECKED) <> $GUI_CHECKED Then GUICtrlSetState($3, $GUI_CHECKED) EndIf $tMsg = TrayGetMsg() Switch $tMsg Case $TRAY_EVENT_PRIMARYUP GUISetState() WinActivate($hGUI) TraySetState(2) Case $tExit Exit EndSwitch WEnd ~Left-Click the tray icon to restore. Edited June 14, 2011 by katoNkatoNK Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 15, 2011 Author Moderators Share Posted June 15, 2011 katoNkatoNK,You obviously missed this post as you speed-read the thread to see if I had already produced a solution. You need to use _GUIExtender_Restore to get over this Windows-induced problem. Just amend your tray code to read|:Switch $tMsg Case $TRAY_EVENT_PRIMARYUP GUISetState() WinActivate($hGUI) TraySetState(2) _GUIExtender_Restore() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $tExit Exit EndSwitchThat works for me. 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...
katoNkatoNK Posted June 15, 2011 Share Posted June 15, 2011 (edited) Aah I remember seeing it in the UDF, but actually missed that post! Thanks Melba23 Edit: Mmm it restores the sections perfectly now! but it seems i have another problem similar to Lupo73's but with menu items. Once restored..The first sections 'arrow' disappears and becomes a menu's item - in the place of the dynamic menu items that were previously there OR the arrow becomes the dynamic menu items handles. (In the case of either of the outcomes both the menu items funcion and the section is triggerred) I hope i didn't miss anything else Edit2: It gave me this error, for the first time only now: C:\Users\mAtt\Desktop\GUIExtender.au3 (448) : ==> Subscript used with non-Array variable.: If $aPos[0] < $iGUI_Fixed Then If $aPos^ ERROR Edit3: lol.. it seems to have fixed itself after i shuffled some functions around that set menu items on the tray/gui. Edited June 15, 2011 by katoNkatoNK Link to comment Share on other sites More sharing options...
telmob Posted July 9, 2011 Share Posted July 9, 2011 Hello everyone. Good to be here. This script is very nice, but i need some help to make my GUI nice and pretty. If i have a GUI with two or three groups, is there a way to extend the second group and retract the previous? For example, if i click a button goupr two extends and group one retracts. Or if i click another button, group 2 extends and group three retracts. Is this possible? This way i would only have an extended group at a time. Thank you for your time and sorry to bother you with noob questions. Link to comment Share on other sites More sharing options...
coolboy2295 Posted August 11, 2011 Share Posted August 11, 2011 Hi that's good, but i can't use with obj. Please help me. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 11, 2011 Author Moderators Share Posted August 11, 2011 telmob, My apologies for having missed your post - I hope this is not too late. You can easily do what you want by using your own controls to action the sections rather than using the built-in versions. This should explain: expandcollapse popup#include <GUIConstantsEx.au3> #include "GUIExtender.au3" $hGUI = GUICreate("Test", 300, 390) _GUIExtender_Init($hGUI) _GUIExtender_Section_Start(0, 60) GUICtrlCreateGroup(" 1 - Static ", 10, 10, 280, 50) ; Create buttons which we can program $hButton_2 = GUICtrlCreateButton("Sect 2", 80, 20, 50, 30) $hButton_4 = GUICtrlCreateButton("Sect 4", 150, 20, 50, 30) $hButton_0 = GUICtrlCreateButton("None", 220, 20, 50, 30) _GUIExtender_Section_End() _GUIExtender_Section_Start(60, 110) _GUIExtender_Section_Action(2) ; Set Section 2 to be extendable, but do NOT create an automatic button GUICtrlCreateGroup(" 2 - Extendable ", 10, 70, 280, 100) _GUIExtender_Section_End() _GUIExtender_Section_Start(170, 60) GUICtrlCreateGroup(" 3 - Static", 10, 180, 280, 50) _GUIExtender_Section_End() _GUIExtender_Section_Start(230, 60) _GUIExtender_Section_Action(4) ; Set Section 4 to be extendable, but do NOT create an automatic button GUICtrlCreateGroup(" 4 - Extendable ", 10, 240, 280, 50) _GUIExtender_Section_End() _GUIExtender_Section_Start(290, 90) GUICtrlCreateGroup(" 5 - Static", 10, 300, 280, 80) _GUIExtender_Section_End() GUICtrlCreateGroup("", -99, -99, 1, 1) ; Retract all sections _GUIExtender_Section_Extend(0, False) GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit ; Now we program our buttons Case $hButton_0 _GUIExtender_Section_Extend(0, False) ; Retract all open sections Case $hButton_2 _GUIExtender_Section_Extend(0, False) ; Retract all open sections _GUIExtender_Section_Extend(2) ; Extend section 2 Case $hButton_4 _GUIExtender_Section_Extend(0, False) ; As above but extend section 4 _GUIExtender_Section_Extend(4) EndSwitch ; And we no longer need to use this because we have NO automatic buttons ;_GUIExtender_Action($iMsg) ; Check for click on Action control WEnd All clear? 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...
Moderators Melba23 Posted August 11, 2011 Author Moderators Share Posted August 11, 2011 coolboy2295,Have you read post #27 which explains why and how you need to use the _GUIExtender_Obj_Data function when dealing with objects? If that does not work then please post a simple reproducing script and I will take a look at it. 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...
coolboy2295 Posted August 21, 2011 Share Posted August 21, 2011 Oh sorry i didn't see that. Now that problem is ok. But i cannot use with gui have a child gui, the child gui not hide. My program is use enventmode so the last solution is update the Function. Please help me with that. Thannks Link to comment Share on other sites More sharing options...
Recommended Posts