Jump to content

Multiple Child Guis with same control on each


Recommended Posts

I have a program that can have many child guis at the same time that have the same controls on them.

The problem i am having is that it seems that only the most recently created guis controls are working.

Example, i have a button, on each gui, that will check all of a bunch of checkboxes in a treeview control, it works fine for the most recently create gui, but if i hit the button on a previously created gui, the checkboxes get checked in the most recently create one.

I know this could be solved using arrays for the controls since thats is how i am handling the multiple guis.

Is there an easier way? Ideally something like gui2.control1

Any suggestions would be great.

I would post the code but it is big and it requires a database to work properly.

Edited by momar33
Link to comment
Share on other sites

I think GUISwitch() is what you need :D

I tried that. I am using OnEventMode and i put the GuiSwitch in the checkall button's event using @GUI_WINHANDLE.

Func _CheckAllLevels()
    ConsoleWrite("Handle = " & @GUI_WINHANDLE & @CRLF)
    For $i = 1 to 9
        _GUICtrlTreeView_SetChecked($levelTV, $levelItem[$i])

This did not work, it still affects only the most recently created gui.

Link to comment
Share on other sites

The best approach that I found for this was to make the main GUI higher than the child GUI's then place common controls in the extra space created. There should be no need for multiple "Check All" buttons. You should only need 1 of them. One of my apps has around 28 Windows and I re-use several controls to maipulate various other controls and functions. I'm not sure that OnEventMode is the way to go with this though. I use Msg loops for doing it.


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

  • Recently Browsing   0 members

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