Jump to content

refreshing part of GUI


kiboost
 Share

Recommended Posts

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

  • Moderators

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
EndFunc

I 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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Times up ;)

All clear? :)

Clear as mud. Edited 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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

  • Moderators

George,

I am flexible and can cope with both. How does the saying go - somehting about "old dogs, new tricks"? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...