hummus Posted June 30, 2020 Posted June 30, 2020 Melba23, Sure - here's the whole code for my tool You'll notice the same problem happens when you check the "Improbable File Size" box, as well as the "Output a single frame..." box - if those toggle like are turned off. Note also that I wanted to hide the whole "Output Images Folder" with a toggle of the checkbox (not just disable that - but shrinking the UI when it's unchecked) - but have had trouble with that. Don't know why. Maybe the way I defined the sizes of the sections. Test_Movie_Integrity_1.22.au3
Moderators Melba23 Posted June 30, 2020 Author Moderators Posted June 30, 2020 (edited) hummus, My UDF is blameless for the non-responsive nature of your input - the basic problem lies in this line: $Label_BadFrames = GUICtrlCreateLabel("BadFrames:", 60, 143, 80, 15) The label is too long for its content and overlaps the $BadFramesThreshold input. As always, AutoIt cannot read your mind to know which overlapped control to action and so refuses to action either - hence your input becomes unresponsive. The solution: either shorten the label (50 width seems to work) or disable the label. I imagine the same is happening for the other controls that you claim are unresponsive - but I leave that to you to determine. In future, if you ever get unresponsive controls, looking for overlapping labels is always the first thing to do. Top Tip: I use GUICtrlSetBackColor to check how big the labels actually are. Here is a very stripped version of your script showing how I would have dealt with the various sections - many of them could be combined into larger single sections. There is nothing to stop you having more sections than needed, but reducing them to a minimum makes for cleaner code IMO. I have added coloured labels so that you see the various sections (red/blue for fixed - green for active). I also recalculated the section depth parameters to match their actual sizes - your original ones were all over the place! And I have added the code to extend/retract the "Output Images Folder" using the checkbox as you wanted. expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> ; for $ES_NUMBER #include <WindowsConstants.au3> #include <UpDownConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include "GUIExtender.au3" ; for the collapsing Bad Frames settings Local $helpmenu, $infoitem, $exititem, $msg, $mainWin_Pos, $TestFileList Global $mainWin, $aboutWin, $infoWin, $Root_Folder, $Master_Folder, $MovieFormat, $FirstFile = "", $MasterFileList, $XS_n, $NumFilesTested, $NumFilesMaster Global $cutNameFrom, $cutNameTo, $currentProgressAll2, $currentProgressAll, $FirstFileFolderNoExt, $cutFileFolder, $OutImage_Folder = "" Global $LevelFolderList = [] $TestSingleFolderSelection = true #region GUI $mainWin = GUICreate("Test Movie Integrity v1.21", 340, 875) $mainWin_Pos = WinGetPos($mainWin, "") Local $filemenu = GUICtrlCreateMenu("&File") GUICtrlSetState(-1, $GUI_DEFBUTTON) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $helpmenu = GUICtrlCreateMenu("Help") $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) _GUIExtender_Init($mainWin, 0, 0, True) ; adding the ",0 ,0, True" (true really) - enables the spinners to show in the hidden section ; Start defining sections - this is everything up to the first active section $checkBoxes_Section = _GUIExtender_Section_Create($mainWin, 0, 130) ; Just to show section height - red = fixed, green = active GUICtrlCreateLabel("", 0, 0, 10, 130) GUICtrlSetBkColor(-1, 0xFF0000) GUIStartGroup() $String_Title = "PERFORM THE FOLLOWING TESTS:" $Label_Title = GUICtrlCreateLabel($String_Title, 85, 10, 200, 15) $Test_Audio = GUICtrlCreateCheckbox("Missing Audio", 50, 40, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Test_Black = GUICtrlCreateCheckbox("Bad Frames", 50, 65, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Test_Missing = GUICtrlCreateCheckbox("Missing Files", 50, 90, 100, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) $Test_Length = GUICtrlCreateCheckbox("Incorrect Movie Length", 170, 40, 150, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) $Test_Resolution = GUICtrlCreateCheckbox("Incorrect Movie Resolution", 170, 65, 150, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) $Test_Size = GUICtrlCreateCheckbox("Improbable File Size", 170, 90, 150, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) GUICtrlCreateLabel("Bad Frames Settings...", 70, 115, 150, 15) _GUIExtender_Section_Activate($mainWin, $checkBoxes_Section + 1, "", "", 48, 115, 15, 15) ; Note easy way to denote next section ; Only need start a new section here - everything above is in the same fixed section $BadFramesSettings_Section = _GUIExtender_Section_Create($mainWin, -1, 30) ; Save the section ID as a variable to use later ; Just to show section height GUICtrlCreateLabel("", 0, 130, 10, 30) GUICtrlSetBkColor(-1, 0x00FF00) $Label_Threshold = GUICtrlCreateLabel("Threshold of:", 10, 134, 100, 15) $Label_BadFrames = GUICtrlCreateLabel("BadFrames:", 60, 143, 80, 15) Global $iInitialValue = 0.6 Global $iIncrement = .1 $BadFramesThreshold = GUICtrlCreateInput($iInitialValue, 115, 140, 30, 20, $ES_NUMBER) $cDummyInput = GUICtrlCreateInput("", 160, 140, 1, 20) $BadFramesThresholdSpinner = GUICtrlCreateUpdown($cDummyInput, $UDS_ARROWKEYS) GUICtrlSetFont ($Label_Threshold, 7, 500, 0, "Tahoma") GUICtrlSetFont ($Label_BadFrames, 7, 500, 0, "Tahoma") GUICtrlSetFont ($BadFramesThreshold, 7, 500, 0, "Tahoma") $Label_Artefacts = GUICtrlCreateLabel("Artefacts:", 165, 143, 60, 15) $ArtefactsThreshold = GUICtrlCreateInput("205", 210, 140, 45, 20, $ES_NUMBER) $ArtefactsThresholdSpinner = GUICtrlCreateUpdown($ArtefactsThreshold, 0x0080) ; 0x0080 prevents the thousand separator that would read the number incorrectly GUICtrlSetLimit(-1, 1000, 0) GUICtrlSetFont ($Label_Artefacts, 7, 500, 0, "Tahoma") GUICtrlSetFont ($ArtefactsThreshold, 7, 500, 0, "Tahoma") $Label_Flicker = GUICtrlCreateLabel("Flicker:", 258, 143, 40, 15) $FlickerThreshold = GUICtrlCreateInput("30", 290, 140, 40, 20, $ES_NUMBER) $FlickerThresholdSpinner = GUICtrlCreateUpdown($FlickerThreshold, 0x0080) ; 0x0080 prevents the thousand separator that would read the number incorrectly GUICtrlSetLimit(-1, 100, 0) GUICtrlSetFont ($Label_Flicker, 7, 500, 0, "Tahoma") GUICtrlSetFont ($FlickerThreshold, 7, 500, 0, "Tahoma") ; Now we start the next fixed section $Movie_Section = _GUIExtender_Section_Create($mainWin, -1, 420) GUICtrlCreateLabel("", 0, 160, 10, 420) GUICtrlSetBkColor(-1, 0x0000FF) $String_MovieFormat = "Movie Format:" $Label_MovieFormat = GUICtrlCreateLabel($String_MovieFormat, 50, 183, 80, 15) $MovieFormat_Combo = GUICtrlCreateCombo("MP4", 120, 180, 50, 20) GUICtrlSetData($MovieFormat_Combo, "MOV|AVI", "MP4") ;GUICtrlSetTip($MovieFormat_Combo, "Make sure the right movie format is set here", "Movie Format", 1, 1) $String_SizeThreshold = "Size Threshold:" $Label_SizeThreshold = GUICtrlCreateLabel($String_SizeThreshold, 212, 163, 80, 15) GUICtrlSetState(-1, $GUI_DISABLE) $SizeThreshold = GUICtrlCreateInput("5000", 50, 10, 50, 30, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $SizeThresholdSpinner = GUICtrlCreateUpdown($SizeThreshold, 0x0080) ; 0x0080 prevents the thousand separator that would read the number incorrectly GUICtrlSetLimit(-1, 10000, 0) GUICtrlSetPos($SizeThreshold, 212, 182, 50, 20) GUICtrlSetState(-1, $GUI_DISABLE) $SizeFormat_Combo = GUICtrlCreateCombo("", 265, 182, 50, 20) GUICtrlSetData($SizeFormat_Combo, "Bytes|Kb|Mb|Gb", "Kb") GUICtrlSetState(-1, $GUI_DISABLE) ; No need for this section - the controls are still in the fixed section we created earlier ;$Folder_Section = _GUIExtender_Section_Create($mainWin, 208, 400) $TestMethodSingle = GUICtrlCreateRadio("Test Single Folder", 70, 210, 110, 15) $TestMethodRoot = GUICtrlCreateRadio("Use Root Folder", 190, 210, 110, 15) GUICtrlSetState($TestMethodSingle, $GUI_CHECKED) $Hide_Reports = GUICtrlCreateCheckbox("Hide Report Notifications", 70, 226, 210, 20) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetFont ($Hide_Reports, 7, 500, 0, "Tahoma") $String_DirLevel = "Directory Levels:" $Label_DirLevel = GUICtrlCreateLabel($String_DirLevel, 210, 230, 80, 15) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetFont ($Label_DirLevel, 7, 500, 0, "Tahoma") $DirLevel = GUICtrlCreateInput("2", 10, 10, 10, 30, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $DirLevelSpinner = GUICtrlCreateUpdown($DirLevel) GUICtrlSetLimit(-1, 9, 1) GUICtrlSetPos($DirLevel, 285, 227, 35, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("Test Movie Folder", 20, 250, 300, 90) ; Movie Folder Button $Control_MovieFolderButton = GUICtrlCreateButton("Select Test Movie Folder", 60, 270, 220, 25) $String_MovieFolder = "not set" $Label_MovieFolder = GUICtrlCreateLabel($String_MovieFolder, 30, 300, 280, 15, $SS_CENTER) $String_FoundFiles = "" $Label_FoundFiles = GUICtrlCreateLabel($String_FoundFiles, 30, 320, 280, 15, $SS_CENTER) GUICtrlCreateGroup("Master Movie Folder", 20, 355, 300, 190) ; Master Movie Folder Button $Control_MasterMovieFolderButton = GUICtrlCreateButton("Select Master Movie Folder", 60, 375, 220, 25) GUICtrlSetState(-1, $GUI_DISABLE) $String_MasterMovieFolder = "not set" $Label_MasterMovieFolder = GUICtrlCreateLabel($String_MasterMovieFolder, 30, 405, 280, 15, $SS_CENTER) GUICtrlSetState(-1, $GUI_DISABLE) $String_MasterFoundFiles = "" $Label_MasterFoundFiles = GUICtrlCreateLabel($String_MasterFoundFiles, 45, 425, 250, 15, $SS_CENTER) GUICtrlSetState(-1, $GUI_DISABLE) $Label_Identity1 = GUICtrlCreateLabel("Identical names starts at:", 30, 445) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameLeft = GUICtrlCreateInput("5", 10, 10, 50, 20, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameLeftSpinner = GUICtrlCreateUpdown($cutNameLeft) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetPos($cutNameLeft, 150, 443, 40, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetTip($cutNameLeft, "Number of characters to cut from the START of the name for comparison", "Identical Base", 1, 1) Local $cutNameFrom = Number(GUICtrlRead($cutNameLeft)) $Label_Identity2 = GUICtrlCreateLabel("Cut from end:", 200, 445) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameRight = GUICtrlCreateInput("0", 10, 10, 50, 20, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameRightSpinner = GUICtrlCreateUpdown($cutNameRight) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetPos($cutNameRight, 270, 443, 40, 20) GUICtrlSetState(-1, $GUI_DISABLE) Local $cutNameTo = Number(GUICtrlRead($cutNameRight)) $Label_IdentityExample = GUICtrlCreateLabel("Example first file:", 30, 475) GUICtrlSetState(-1, $GUI_DISABLE) $String_FirstFile = "This will show the first file" $Label_FirstFile = GUICtrlCreateLabel($String_FirstFile, 120, 475, 180, 15) GUICtrlSetState(-1, $GUI_DISABLE) $Label_IdentityPortion = GUICtrlCreateLabel("Identical portion:", 30, 495) GUICtrlSetState(-1, $GUI_DISABLE) $String_Portion = "This will show the portion to compare" $Label_Portion = GUICtrlCreateLabel($String_Portion, 120, 495, 180, 15) GUICtrlSetState(-1, $GUI_DISABLE) $compareLogical = GUICtrlCreateRadio("Logical Comparison", 45, 520, 110, 15) GUICtrlSetState(-1, $GUI_DISABLE) $comparePortion = GUICtrlCreateRadio("Compare Using Portion", 165, 520, 130, 15) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState($compareLogical, $GUI_CHECKED) ; Again, need for this section as we are still in the fixed section from way earlier ;$imgOutput_Section = _GUIExtender_Section_Create($mainWin, 555, 50) $Test_Output = GUICtrlCreateCheckbox("Output a Single Frame at a defined time", 50, 560, 220, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) ; Only here do we need to start the next active section as everything above is fixed since the first active section $img_Section = _GUIExtender_Section_Create($mainWin, -1, 170) GUICtrlCreateLabel("", 0, 580, 10, 170) GUICtrlSetBkColor(-1, 0x00FF00) ; Activate this section only vis program calls _GUIExtender_Section_Activate($mainWin, $img_Section) GUICtrlCreateGroup("Output Images Folder", 20, 590, 300, 150) ; Output Folder Button $Control_OutputImageFolderButton = GUICtrlCreateButton("Select Output Images Folder", 60, 610, 220, 25) GUICtrlSetState(-1, $GUI_DISABLE) $String_OutputImageFolder = "not set" $Label_OutputImageFolder = GUICtrlCreateLabel($String_OutputImageFolder, 30, 640, 280, 15, $SS_CENTER) GUICtrlSetState(-1, $GUI_DISABLE) $Label_OutputTime1 = GUICtrlCreateLabel("Defined Time:", 80, 660) GUICtrlSetState(-1, $GUI_DISABLE) $Label_OutputTime2 = GUICtrlCreateLabel("Seconds", 195, 660) GUICtrlSetState(-1, $GUI_DISABLE) $OutputTime = GUICtrlCreateInput("4", 10, 10, 50, 20) GUICtrlSetState(-1, $GUI_DISABLE) $OutputTimeSpinner = GUICtrlCreateUpdown($OutputTime) GUICtrlSetPos($OutputTime, 150, 658, 40, 20) $Label_FileFolder = GUICtrlCreateLabel("Subfolder names start at:", 30, 692) GUICtrlSetState(-1, $GUI_DISABLE) $cutFileFolderName = GUICtrlCreateInput("5", 10, 10, 50, 20, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $cutFileFolderNameSpinner = GUICtrlCreateUpdown($cutFileFolderName) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetPos($cutFileFolderName, 160, 690, 40, 20) GUICtrlSetState(-1, $GUI_DISABLE) Local $cutFileFolder = Number(GUICtrlRead($cutFileFolderName)) $Label_FileFolderExample = GUICtrlCreateLabel("Subfolder of first file:", 30, 715) GUICtrlSetState(-1, $GUI_DISABLE) $String_FirstFileFolder = "This will show the first File-Folder" $Label_FirstFileFolder = GUICtrlCreateLabel($String_FirstFileFolder, 130, 715, 180, 15) GUICtrlSetState(-1, $GUI_DISABLE) ; And now a final fixed section until the end of the GUI $end_Section = _GUIExtender_Section_Create($mainWin, -1, -1) GUICtrlCreateLabel("", 0 , 750, 10, 125) GUICtrlSetBkColor(-1,0xFF0000) $Testbutton = GUICtrlCreateCheckbox("RUN TESTS", 120, 750, 100, 40, $BS_PUSHLIKE) $String_Progress = "Awaiting..." $Label_Progress = GUICtrlCreateLabel($String_Progress, 75, 795, 200, 15, $SS_CENTER) $String_Counter = "" $Label_Counter = GUICtrlCreateLabel($String_Counter, 240, 795, 80, 15, $SS_RIGHT) $ProgressBarTest = GUICtrlCreateProgress(20, 815, 300, 8) GUICtrlSetColor($ProgressBarTest,0x0099ff) $ProgressBarAll = GUICtrlCreateProgress(20, 828, 300, 10) GUICtrlSetColor($ProgressBarAll,0x00ff00) $ProgressBarSubfolders = GUICtrlCreateProgress(20, 843, 300, 6) GUICtrlSetColor($ProgressBarSubfolders,0xff0000) _GUIExtender_Section_Create($mainWin, -99) GUICtrlCreateGroup("", -99, -99, 1, 1) ; Retract all extendable sections _GUIExtender_Section_Action($mainWin, 0, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cDummyInput GuiCtrlSetData($BadFramesThreshold, $iInitialValue + GuiCtrlRead($cDummyInput) * $iIncrement) Case $Test_Output If GUICtrlRead($Test_Output) = $GUI_CHECKED Then ; Display section _GUIExtender_Section_Action($mainWin, $img_Section) Else ; Hide section _GUIExtender_Section_Action($mainWin, $img_Section, 0) EndIf EndSwitch _GUIExtender_EventMonitor($mainWin, $nMsg) WEnd Please ask if you have any further questions. M23 Edited June 30, 2020 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
hummus Posted July 1, 2020 Posted July 1, 2020 Melba23, You've been a great help! Thank you very much for this!
Dan_555 Posted July 1, 2020 Posted July 1, 2020 Hi. I'v just downloaded the UDF from the 1st Post, and it is great. Noticed one text mistake, in the GUIExtender_Example_6_Object_Tab.au3 HotKeySet("^!a", "_Action_Section_1") HotKeySet("^!b", "_Action_Section_3") ... GUICtrlCreateLabel("Press Ctrl - F1 or Ctrl - F2 to toggle embedded objects", 10, 10, 730, 30) Some of my script sourcecode
Moderators Melba23 Posted July 1, 2020 Author Moderators Posted July 1, 2020 hummus, Glad I could help - do not hesitate to come back if you run into any more problems. Dan_555, Thanks for that - fixed for next release. 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
hummus Posted July 21, 2020 Posted July 21, 2020 Melba23, It's been a couple of weeks since I was able to get to this more thoroughly - but now that I've re-introduced some of the removed parts from my script, that you've removed to show how that works - I seem to have come across this problem again. The script worked fine without the "enabling/disabling" of UI elements - but once I've brought them back I get these ui problems. I'm pretty sure it's because I'm not using it properly. I think I'm just not in the clear of how to define how big each section should be. Even through we have colored labels - adding or removing a few pixels here and there don't seem to affect the behavior much and I'm not sure how you initially define how big each section should be. Please take a look at this stripped-down script that you've sent back to me last time - but now with some UI sections added that enable and disable some sections. As soon as I check boxes or radio buttons I get these artefacts. It may be again because of long label lengths - but maybe it's got to do with bad definitions of section lengths. Thanks. delete_test_movie_integrity_122.au3
Moderators Melba23 Posted July 21, 2020 Author Moderators Posted July 21, 2020 hummus, Everything seems to work fine if you remove all the spinner GUICtrlSetState(*, $GUI_ENABLE/DISABLE) lines - both at creation time and in the various functions. Disabling the input also disables the associated spinner - there is no need to disable the spinner as well. By so doing you are deliberately causing the problem that spinners give the UDF - you cannot read the position of a disabled spinner and so the UDF does not know where to move them when sections are expanded/retracted. 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
hummus Posted July 21, 2020 Posted July 21, 2020 Melba23, Unbelievable! Again - a great help. I was not aware of the fact that the input affects the spinner as well. Thanks again! Dani.
Moderators Melba23 Posted July 21, 2020 Author Moderators Posted July 21, 2020 hummus, Glad I could help so quickly. M23 hummus 1 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
dmob Posted March 20, 2021 Posted March 20, 2021 (edited) Hi Melba, I have a GUI with 3 collapsible sections, that extend beyond the height of the GUI. I would like to collapse 2 of the sections when a user extends any one of them. Is there any way to monitor & action this other than hacking the _GUIExtender_EventMonitor function? Edited March 20, 2021 by dmob
Moderators Melba23 Posted March 20, 2021 Author Moderators Posted March 20, 2021 dmob, How about this as a blueprint: expandcollapse popup#include <GUIConstantsEx.au3> #include "GUIExtender.au3" $hGUI = GUICreate("Test", 500, 700) _GUIExtender_Init($hGUI) $iSection_0 = _GUIExtender_Section_Create($hGUI, 0, 100) $cButton_1 = GUICtrlCreateButton("Section 1", 10, 10, 80, 30) $cButton_2 = GUICtrlCreateButton("Section 2", 110, 10, 80, 30) $cButton_3 = GUICtrlCreateButton("Section 3", 210, 10, 80, 30) $iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 200) _GUIExtender_Section_Activate($hGUI, $iSection_1) GUICtrlCreateLabel("Section 1", 10, _GUIExtender_Section_BaseCoord($hGUI, $iSection_1) + 10) $iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 200) _GUIExtender_Section_Activate($hGUI, $iSection_2) GUICtrlCreateLabel("Section 2", 10, _GUIExtender_Section_BaseCoord($hGUI, $iSection_2) + 60) $iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 200) _GUIExtender_Section_Activate($hGUI, $iSection_3) GUICtrlCreateLabel("Section 3", 10, _GUIExtender_Section_BaseCoord($hGUI, $iSection_3) + 110) _GUIExtender_Section_Create($hGUI, -99) _GUIExtender_Section_Action($hGUI, $iSection_2, 0) _GUIExtender_Section_Action($hGUI, $iSection_3, 0) GUICtrlSetState($cButton_1, $GUI_DISABLE) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $cButton_1 _GUIExtender_Section_Action($hGUI, $iSection_1, 1) _GUIExtender_Section_Action($hGUI, $iSection_2, 0) _GUIExtender_Section_Action($hGUI, $iSection_3, 0) GUICtrlSetState($cButton_1, $GUI_DISABLE) GUICtrlSetState($cButton_2, $GUI_ENABLE) GUICtrlSetState($cButton_3, $GUI_ENABLE) Case $cButton_2 _GUIExtender_Section_Action($hGUI, $iSection_1, 0) _GUIExtender_Section_Action($hGUI, $iSection_2, 1) _GUIExtender_Section_Action($hGUI, $iSection_3, 0) GUICtrlSetState($cButton_1, $GUI_ENABLE) GUICtrlSetState($cButton_2, $GUI_DISABLE) GUICtrlSetState($cButton_3, $GUI_ENABLE) Case $cButton_3 _GUIExtender_Section_Action($hGUI, $iSection_1, 0) _GUIExtender_Section_Action($hGUI, $iSection_2, 0) _GUIExtender_Section_Action($hGUI, $iSection_3, 1) GUICtrlSetState($cButton_1, $GUI_ENABLE) GUICtrlSetState($cButton_2, $GUI_ENABLE) GUICtrlSetState($cButton_3, $GUI_DISABLE) EndSwitch _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) WEnd Please ask if this is not quite what you were after. 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
dmob Posted March 20, 2021 Posted March 20, 2021 (edited) Hi Melba, not quite; I was hoping to accomplish without additional buttons. I just had an idea that got me out of bed... to check if perhaps _GUIExtender_Section_Activate returned a contol id, but sadly just returns 1. The control id is stored in an internal array. I would like to know when the user clicks one of the Section_Activate buttons. How about this function return the control id for the created button (or in @extended) which I can then easily detect with GUIGetMsg? Edited March 21, 2021 by dmob Add. info
Moderators Melba23 Posted March 21, 2021 Author Moderators Posted March 21, 2021 dmob, Quote I was hoping to accomplish without additional buttons So just how do envisage that working? Closing section 1 or 3 leading to the opening of section 2 is obvious, but what do you expect to happen when you close section 2? Which of the other sections opens? If you can explain your required behaviour then it should be possible to get something working without additional buttons. 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
Moderators Melba23 Posted March 21, 2021 Author Moderators Posted March 21, 2021 dmob, How about this - just the one button: expandcollapse popup#include <GUIConstantsEx.au3> #include "GUIExtender.au3" $hGUI = GUICreate("Test", 500, 600) _GUIExtender_Init($hGUI) $iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_1 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_1) _GUIExtender_Section_Activate($hGUI, $iSection_1) GUICtrlCreateLabel("Section 1", 10, $iY_1 + 10) $cButton_1 = GUICtrlCreateButton("Open Section 2", 400, $iY_1 + 160, 80, 30) $iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_2 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_2) _GUIExtender_Section_Activate($hGUI, $iSection_2) GUICtrlCreateLabel("Section 2", 10, $iY_2 + 10) $cButton_2 = GUICtrlCreateButton("Open Section 3", 400, $iY_2 + 160, 80, 30) $iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_3 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_3) _GUIExtender_Section_Activate($hGUI, $iSection_3) GUICtrlCreateLabel("Section 3", 10, $iY_3 + 10) $cButton_3 = GUICtrlCreateButton("Open Section 2", 400, $iY_3 + 160, 80, 30) _GUIExtender_Section_Create($hGUI, -99) _GUIExtender_Section_Action($hGUI, $iSection_2, 0) _GUIExtender_Section_Action($hGUI, $iSection_3, 0) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $cButton_1, $cButton_3 _GUIExtender_Section_Action($hGUI, $iSection_1, 0) _GUIExtender_Section_Action($hGUI, $iSection_2, 1) _GUIExtender_Section_Action($hGUI, $iSection_3, 0) Case $cButton_2 If GUICtrlRead($cButton_2) = "Open Section 3" Then _GUIExtender_Section_Action($hGUI, $iSection_1, 0) _GUIExtender_Section_Action($hGUI, $iSection_2, 0) _GUIExtender_Section_Action($hGUI, $iSection_3, 1) GUICtrlSetData($cButton_2, "Open Section 1") Else _GUIExtender_Section_Action($hGUI, $iSection_1, 1) _GUIExtender_Section_Action($hGUI, $iSection_2, 0) _GUIExtender_Section_Action($hGUI, $iSection_3, 0) GUICtrlSetData($cButton_2, "Open Section 3") EndIf EndSwitch _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) ; Check for click on section action control WEnd 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
dmob Posted March 21, 2021 Posted March 21, 2021 @Melba, thank you for your responses. These are my 3 sections, with Section_Action buttons to the left of the labels. I would like to detect when a user clicks one of the buttons to extend any section, so that I can programmatically close any other extended section and show only the selected/clicked section. I require that only one section is extended at any time, the other two closed.
Moderators Melba23 Posted March 21, 2021 Author Moderators Posted March 21, 2021 (edited) dmob, I have slightly modified _GUIExtender_EventMonitor which now only returns 1 when a section has been actioned and sets @extended to the section index. So now you can determine when a section has been actioned and close all the others: GUIExtender_Mod.au3 And here is an example to test it: expandcollapse popup#include <GUIConstantsEx.au3> #include "GUIExtender_Mod.au3" $hGUI = GUICreate("Test", 500, 690) _GUIExtender_Init($hGUI) $iSection_1 = _GUIExtender_Section_Create($hGUI, 0, 30) $iY_1 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_1) _GUIExtender_Section_Activate($hGUI, $iSection_1 + 1, "", "", 0, $iY_1, 20, 20) GUICtrlCreateLabel("First Section Header", 30, $iY_1, 200, 20) $iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_2 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_2) GUICtrlCreateLabel("First Section Text", 10, $iY_2 + 10, 100, 100) GUICtrlSetBkColor(-1, 0xFFCCCC) $iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 30) $iY_3 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_3) _GUIExtender_Section_Activate($hGUI, $iSection_3 + 1, "", "", 0, $iY_3, 20, 20) GUICtrlCreateLabel("Second Section Header", 30, $iY_3, 200, 20) $iSection_4 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_4 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_4) GUICtrlCreateLabel("Second Section Text", 10, $iY_4 + 10, 100, 100) GUICtrlSetBkColor(-1, 0xCCFFCC) $iSection_5 = _GUIExtender_Section_Create($hGUI, -1, 30) $iY_5 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_5) _GUIExtender_Section_Activate($hGUI, $iSection_5 + 1, "", "", 0, $iY_5, 20, 20) GUICtrlCreateLabel("Third Section Header", 30, $iY_5, 200, 20) $iSection_6 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_6 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_6) GUICtrlCreateLabel("Third Section Text", 10, $iY_6 + 10, 100, 100) GUICtrlSetBkColor(-1, 0xCCCCFF) _GUIExtender_Section_Create($hGUI, -99) _GUIExtender_Section_Action($hGUI, 0, 0) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch ; Check for click on section action control If _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) = 1 Then ; Action took place $iLastAction = @extended ; Section actioned ; Now run through the sections For $i = $iSection_2 To $iSection_6 Step 2 ; Do nothing to the actioned sections If $i <> $iLastAction Then ; But retract all the others _GUIExtender_Section_Action($hGUI, $i, 0) EndIf Next EndIf WEnd Does that solve your problem? M23 Edit: I have just realised that this is not a complete solution - so still a bit of work to do. Edited March 21, 2021 by Melba23 dmob 1 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
dmob Posted March 21, 2021 Posted March 21, 2021 Thank you @Melba, does exactly what I need I appreciate you looking into this so quick, on a Sunday nogal (SA slang: even tho) 1 hour ago, Melba23 said: so still a bit of work to do. Its working... or is there some more trickery to come from your goodie bag
dmob Posted March 24, 2021 Posted March 24, 2021 (edited) On 3/21/2021 at 6:02 PM, Melba23 said: so still a bit of work to do Hi @Melba, I have just successfully hacked the _GUIExtender_Section_Activate and __GUIExtender_Action_Section functions to use a custom icon instead of default arrows or text; works a treat, the elegant structure of your code makes it easy to hack, modify and learn I set the $iType parameter to 2 to indicate icon image and the $sText_Extended & $sText_Retracted parameters to specify Up/Down icon files. May I kindly ask if you could include such a feature in your upcoming update? Or even match the Notify UDF with .png image Edited March 24, 2021 by dmob
Moderators Melba23 Posted March 24, 2021 Author Moderators Posted March 24, 2021 dmob, I would be happy to look at the changes you made, but please let me see the altered code! 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
dmob Posted March 24, 2021 Posted March 24, 2021 (edited) @Melba Edits marked/enclosed by <========================= dmob edit expandcollapse popup; #FUNCTION# ========================================================================================================= ; Name...........: _GUIExtender_Section_Activate ; Description ...: Creates buttons for extension/retraction of GUI sections ; Syntax.........: _GUIExtender_Section_Activate($hWnd, $iSection[, $sText_Extended = ""[, $sText_Retracted = ""[, $iX = 0[, $iY = 0[, $iW = 0[, $iH = 0[, $iType = 0[, $iEventMode = 0]]]]]]]]]) ; Parameters ....: $hWnd - Handle of GUI containing the section ; $iSection - Section to action ; 0 = all extendable sections ; $sText_Extended - Text on button when section is extended - default: small up/left arrow ; If $iType = 2 : icon for up arrow ; $sText_Retracted - Text on button when section is retracted - default: small down/right arrow ; If $iType = 2 : icon for down arrow ; $iX - Left side of the button ; $iY - Top of the button ; $iW - Width of the button ; $iH - Height of the button ; $iType - Type of button: ; 0 = pushbutton (default) ; 1 = normal button ; 2 = icon <=================================================================== dmob edit ; $iEventMode - 0 = (default) MessageLoop mode ; 1 = OnEvent mode - control automatically linked to __GUIExtender_Section_Event function ; Requirement(s).: v3.3 + ; Return values .: Success: Returns 1 ; Failure: Returns 0 and sets @error as follows: ; 1 = GUI not initialised ; 2 = Control not created ; Author ........: Melba23 ; Remarks .......: Sections are static unless an action control has been set ; Omitting all optional parameters creates a section which can only be actioned programmatically ; Example........: Yes ;===================================================================================================================== Func _GUIExtender_Section_Activate($hWnd, $iSection, $sText_Extended = "", $sText_Retracted = "", $iX = 0, $iY = 0, $iW = 1, $iH = 1, $iType = 0, $iEventMode = 0) ;~Snip ;<============================================================== dmob edit ; What type of button? Switch $iType ; Pushbutton Case 0 ; Create normal button $aActive_Section_Data[$iSection][5] = GUICtrlCreateButton($sText_Extended, $iX, $iY, $iW, $iH) Case 1 ; Create pushbutton $aActive_Section_Data[$iSection][5] = GUICtrlCreateCheckbox($sText_Extended, $iX, $iY, $iW, $iH, 0x1000) ; $BS_PUSHLIKE ; Set button state GUICtrlSetState(-1, 1) ; $GUI_CHECKED Case 2 ; Create icon $aActive_Section_Data[$iSection][5] = GUICtrlCreateIcon($sText_Extended, -1, $iX, $iY, $iW, $iH) EndSwitch ;<============================================================== dmob edit ; Check for error If $aActive_Section_Data[$iSection][5] = 0 Then Return SetError(2, 0, 0) ; Change font if default arrows required If $iDef_Arrows Then GUICtrlSetFont($aActive_Section_Data[$iSection][5], 10, 400, 0, "Webdings") ; Set event function if required If $iEventMode Then GUICtrlSetOnEvent($aActive_Section_Data[$iSection][5], "__GUIExtender_Section_Event") ; Store required text $aActive_Section_Data[$iSection][6] = $sText_Extended $aActive_Section_Data[$iSection][7] = $sText_Retracted ; Store button type $aActive_Section_Data[$iSection][8] = $iType ; Resave array $aGUIExt_GUI_Data[$iGUI_Index][1] = $aActive_Section_Data Return 1 EndFunc ;==>_GUIExtender_Section_Activate ; ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __GUIExtender_Action_Section ; Description ...: Actions extension/retraction for specified sections ; Author ........: Melba23 ; Modified.......: ; Remarks .......: This function is called to get the specified sections into the correct state ; =============================================================================================================================== Func __GUIExtender_Action_Section(ByRef $aActive_Section_Data, $iStart, $iEnd, $iMode, $iFixed = 9) ;~ ;~ ; Determine whether action required is extension or retraction If $iState Then ; Force action control state if needed ;If $aActive_Section_Data[$iSection][8] = 1 Then GUICtrlSetState($aActive_Section_Data[$iSection][5], 1) ; $GUI_CHECKED ;<============================================================== dmob edit Switch $aActive_Section_Data[$iSection][8] Case 0, 1 ; Change button text GUICtrlSetData($aActive_Section_Data[$iSection][5], $aActive_Section_Data[$iSection][6]) GUICtrlSetState($aActive_Section_Data[$iSection][5], 1) ; $GUI_CHECKED Case 2 GUICtrlSetImage($aActive_Section_Data[$iSection][5], $aActive_Section_Data[$iSection][6], -1) EndSwitch ;<============================================================== dmob edit ; Set section state $aActive_Section_Data[$iSection][2] = 1 ; Add size of section being extended $iGUI_Adjust += $aActive_Section_Data[$iSection][1] Else ; Force action control state if needed ;If $aActive_Section_Data[$iSection][8] = 1 Then GUICtrlSetState($aActive_Section_Data[$iSection][5], 4) ; $GUI_UNCHECKED ;<============================================================== dmob edit Switch $aActive_Section_Data[$iSection][8] Case 0, 1 ; Change button text GUICtrlSetData($aActive_Section_Data[$iSection][5], $aActive_Section_Data[$iSection][7]) GUICtrlSetState($aActive_Section_Data[$iSection][5], 4) ; $GUI_UNCHECKED Case 2 GUICtrlSetImage($aActive_Section_Data[$iSection][5], $aActive_Section_Data[$iSection][7], -1) EndSwitch ;<============================================================== dmob edit ; Set section state $aActive_Section_Data[$iSection][2] = 0 ; Subtract size of section being hidden $iGUI_Adjust -= $aActive_Section_Data[$iSection][1] EndIf ;~ ;~ This was my initial successful hack, I know I might have broken the code for the standard arrow/text option, so... Edited March 24, 2021 by dmob
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