tatane Posted April 6, 2016 Share Posted April 6, 2016 (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 April 6, 2016 by tatane Link to comment Share on other sites More sharing options...
JohnOne Posted April 6, 2016 Share Posted April 6, 2016 return defmsg in case of WM_PAINT AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
AutoBert Posted April 6, 2016 Share Posted April 6, 2016 Please post a runable reprdoucer showin the issue. Link to comment Share on other sites More sharing options...
tatane Posted April 6, 2016 Author Share Posted April 6, 2016 (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 April 6, 2016 by tatane Link to comment Share on other sites More sharing options...
AutoBert Posted April 6, 2016 Share Posted April 6, 2016 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". Link to comment Share on other sites More sharing options...
tatane Posted April 6, 2016 Author Share Posted April 6, 2016 Ah you're right ! I already saw this function but never use it. Now I know why it is usefull. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now