Jump to content

Recommended Posts

Posted (edited)

Hi,

 

I've got a strange "bug" with my script. I'm trying to create a button after clicking on another button. It works perfectly with a small script example but it doesn't with my main script which is too big to be post :( .

The new created button only appears if I add GUISetState(@SW_SHOW, $maingui) AND after the second click on the triggered button.

I'm capturing some Windows Messages like WM_COMMAND, WM_NOTIFY, WM_SIZE, WM_GETMINMAXINFO, WM_SYSCOMMAND, WM_EXITSIZEMOVE, WM_MOVE, _WM_COPYDATA and the style of the main gui is BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX, $WS_MAXIMIZEBOX).

I know that without the script it will be difficult to debug but maybe you already have met this problem before.

 

Case $nMsg[0] = $trig_button
    GUICtrlCreateButton("test button", 50, 95, 60)
    GUISetState(@SW_SHOW, $gui)

I shouldn't have to reset the state of the gui (it is already "show") to show this new button neither click two times on $trig_button (the first click does nothing).

EDIT1 : A consolewrite of the GuiCtrlCreateButton() displays a controlID so the button seems to be created but not displayed.

EDIT2 : Same problem with other controls like combo, checkbox, ...

 

Thanks for your time.

Edited by tatane
Posted (edited)

Actually I just found the problem. Shame on me...

I have my main gui with the creation of controls and the guisetstate() at the end. And after this, I create a tiny gui to add comments in a listview. This gui is hidden by default.

So when the new button/control is created, it's in the last created/called gui : the hidden one...

Then if I GuiSetState(@SW_SHOW, $main_gui) before the GuiControlCreate...(), I'm sure my control appears in the right GUI.

Is there another way to "attach" a new control to a gui ?

Edited by tatane
Posted

Normaly you have to use GuiSwitch for creating buttion to a specific Gui. Withoout it's created in the last creadted Gui. From Helpfile Reamarks to  GuiSwitch

Quote

Many of the GUI specific functions work on the "current" window - this is usually the last window created with GUICreate(). This function allows you to make another window "current".

 

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