Jump to content

Recommended Posts

Posted

Hello,

I need some help with my gui, when I click on button 2 it call a MsgBox 2, but when I click on button 1 then button 2 it call a MsgBox 1.

I tear appart my code to minimal function then the error occur again ...

Here the script :

  Reveal hidden contents

 

 The error :

Run my script, click on "OUVRIR" then click on "View" and click on "GO" you get a message : "L'URL ne semble pas valide."

Now close the view menu, click on "Add entry" , close this menu , click on "View" and click on "GO" you get another message : "Les mots de passe ================================= sont différents."

This message must only appear when you click on "Validate" in the "Add entry" menu ....

I had the same problem on another PC with AutoIT 3.3.14.0

I've changed my variable, add another button , etc... The problem occur only with this two menus and this button.

Can you test it ? If you don't have this error perhaps my AutoIT package (installer form AutoIT fr) have a problem.

Thank you.

  • Moderators
Posted

Stormgrade,

The problem occurs because you are constantly creating and deleting GUIs and their controls. When you delete a control (such as by deleting the GUI that holds it) you leave an empty entry in the internal array that AutoIt uses to track the controls it creates - the index of a control in this array is the ControlID that is returned by the GUICtrlCreate* function.

So when you create one of your subsidiary GUIs the controls within it use the first available open entries in this array - and these indicies will be returned as ControlIDs. When you delete the GUI these entries are cleared, when you create the next GUI the controls will also use those entries and so have those ControlIDs - but the variables holding the ControlIDs of the now-deleted controls will still hold the same value, even though the control itself has been deleted. Then when you run your Switch, the first variable to match will fire - and in this  case it is one which refers to a deleted control.

The solution? Create all the GUIs just once at the beginning of the script and hide/show as required - or set all the variables used to store ControlIDs back to their placeholder values (as you do at the beginning of the script) when you delete a GUI. I know which is the simpler solution.

Please ask if anything is still unclear.

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:

  Reveal hidden contents

 

Posted

Thank you !!!!!!!!!!!

I set all the variables used to store ControlID in the "On_close" function like this :

  Reveal hidden contents

 

 Do you think I just need to do that ? It make me crazy to try to find the error but it seem to work like a charm now :)

  • Moderators
Posted

Stormgrade,

That should work - but I would suggest that the other method I mentioned (creating all the GUIs and then hiding/showing them as required) would be much easier.

Or you could use my GUIExtender UDF to place all the sections within the same GUI and expand/retract the correct section when needed - let me know if you would like some help getting that idea to work.

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:

  Reveal hidden contents

 

Posted

Thank you for your advice, I've used the AutoIt wiki to manage multiple GUI, If I use :

GUISetState(@SW_HIDE, $GUI5)

 GUISetState(@SW_SHOW, $GUI5)

I must "rethink" all I'had done with the GUis.

I've already used your UDF for a protoype, it's very useful for hiding showing GUI inside a GUI but I don't intend to make a password manager inside one GUI.

  • Moderators
Posted

Stormgrade,

That sounds like you have got the measure of the problem - glad I could help you get there.

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:

  Reveal hidden contents

 

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
×
×
  • Create New...