kiboost Posted October 15, 2010 Share Posted October 15, 2010 Hi, I have one GUI, visualy separated in parts, one part listing several things, creating around 300 controls (lables, buttons, pics, etc) I would put a "refresh" button. The listing is ever a function, and positions are relative to a value, so I can reset the position value and restart the function. But seems I have first to delete every labels, buttons etc in this part before redrawing them. It would be a real nightmare to name them and retrieve them all (I've tried ...). So is there a way to globally delete them, for example by a rectanlge selection, or if grouped in a group item ? Didn't found guictrlemptygroup lol ! any idea for this ? I had a solution like registering exit function and restart the whole, but not really a solution Cheers Kib Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 15, 2010 Moderators Share Posted October 15, 2010 kiboost,There is no global/multiple delete function. But you can use a little trick if you create the controls you want to delete in immediate succession. Take a look here: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 500, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_On_Exit") GUICtrlCreateButton("Delete", 10, 10, 80, 30) GUICtrlSetOnEvent(-1, "_On_Delete") $hStart = GUICtrlCreateDummy() GUICtrlCreateButton("I'm Going!", 10, 50, 80, 30) GUICtrlCreateButton("I'm Going!", 10, 90, 80, 30) GUICtrlCreateButton("I'm Going!", 10, 130, 80, 30) $hEnd = GUICtrlCreateDummy() GUICtrlCreateButton("I'm Staying!", 10, 170, 80, 30) GUISetState() While 1 Sleep(10) WEnd Func _On_Delete() For $i = $hStart To $hEnd GUICtrlDelete($i) Next EndFunc Func _On_Exit() Exit EndFuncI assumed you are using OnEvent mode as you said that you had no variables associated with the controls. If you want to do the same thing in GetMessage mode, you can use the ControlIDs of the first and last control and omit the Dummy controls.WARNING: This trick only works if the controls are created in immediate succession. If you are often deleting and then recreating controls, it may not function as you think - particularly if the number of controls is not the same each time. The ControlIDs used to make the loop perform the trick are the indices of the internal array where AutoIt stores its controls. New controls are placed in the first available slot - so if earlier controls have been deleted and left spaces in the array, new controls will not necessarily be created in the same block and the trick will not work.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...
GEOSoft Posted October 15, 2010 Share Posted October 15, 2010 (edited) Times up All clear? Clear as mud. Edited October 15, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 15, 2010 Moderators Share Posted October 15, 2010 George, But I would hardly expect someone who does not like counts in the [0] element of arrays to understand such subtle machinations. And my protected time is up, so feel free to start in again - or was that what you were doing? 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...
GEOSoft Posted October 15, 2010 Share Posted October 15, 2010 You catch on quickly for someone who likes 1 based arrays. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 15, 2010 Moderators Share Posted October 15, 2010 George,I am flexible and can cope with both. How does the saying go - somehting about "old dogs, new tricks"? 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...
GEOSoft Posted October 15, 2010 Share Posted October 15, 2010 I don't think I would refer to you as old just yet but you do need some new tricks. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
kiboost Posted October 16, 2010 Author Share Posted October 16, 2010 Melba, thanks again ! I posted yesterday but my message didn't appear, sorry. You're dummy trick works just perfectly !! Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 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