Jump to content

Multiple GUI, a question


Recommended Posts

I'm using multiple GUI with one loop, simultaneously using the "advanced" parameter with GUIGetMsg, following the tutorial Managing Multiple GUIs

I have a doubt, it declare the second GUI and his button with 9999 using this reason:

Predeclare the variables with dummy values to prevent firing the Case statements

Now my question is, if i'm deleting that GUI with GUIDelete i need to redeclare all that variable with 9999 again for "prevent firing the Case statements"?

I hope is not but i'm wainting for a definite answer. Thanks

Edited by Terenz
spelling, my wrost enemy

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

  • Moderators

Terenz,

No, you  do not need to reset the variable to 9999.

You need something in the variable or else the Case fires off all the time as an empty variable is interpreted as 0 by AutoIt and it matches the "no event" return from GUIGetMsg. Once the variable has been filled with an actual handle, it will look for that value even if the GUI has been deleted - and normally Windows allocates unique handles so it will never be found again until you create a new GUI and replace it.  But just in case Windows were to reuse the same handle, good coding practice says you might wish to reset the variable to 9999 when you delete the GUI.

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

So do you mean, just in case, i need to declare only $hGUI2 to 9999 if i'm deleting it and not all of his control, right? Because re-declare one variable is OK and not a problem, re-declare 250 isn't the best way to use my time :D

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

  • Moderators

Terenz,

As the example in the Wiki shows, you do not have to reset the ControlIDs of any deleted controls as the Switch structure will never enter the section where it tests them because their GUI no longer exists.  And this despite the fact that, unlike Windows handles, AutoIt ControlIDs are reused.

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

Melba so why the tutorial has:

Global $hGUI2 = 9999, $hButton3 = 9999

Instead of:

Global $hGUI2 = 9999, $hButton3

If the button will never fired because of the Switch structure, why declare the control with a dummy value? Isn't that unnecessary?

Another thing, i'd like to have a function for deleting the GUI and re-assing the variable to 9999 but seems in this way not work:

Global $hGUI = "0x123456"

_GUIDelete($hGUI)

MsgBox(0,0,$hGUI)

Func _GUIDelete($var)
    GUIDelete($var)
    $var = 9999
EndFunc

What approach i can use?

P.S. Don't ask me why but on Chrome i have lost the CODE button, i see only "B" "I" "U" "LINK" "QUOTE" "EMOTICON" :(

eoa5u.jpg

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

  • Moderators

Terenz,

Probably because I copied that line from the earlier scripts in the tutorial - nobody is perfect.

In your code snippet you have passed the "handle" by value and so any changes made to it in the function are not reflected outside.  if you were to pass the "handle" by reference then you would get the required result:

Global $hGUI = 0x123456

_GUIDelete($hGUI)

MsgBox(0,0,$hGUI)


Func _GUIDelete(ByRef $var)
    GUIDelete($var)
    $var = 9999
EndFunc

The Variables - using Global, Local, Static and ByRef tutorial in the Wiki explains ByRef in more detail

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

  • Moderators

Terenz,

There seem to be an number of problems with the new editor. Try clearing your cache and restarting the browser.

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

On Chrome nothing change, from IE on another PC i see many buttons include "Add Code", "Spoiler", "Font" things i don't see on Chrome see my screenshot above...the previus layout was also compatible with my phone and i was able to post, this not. Well, i prefer the other one.

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

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...