quake101 Posted September 10, 2009 Share Posted September 10, 2009 I have an odd problem and maybe I'm just overlooking something... I have created a tabbed layout on my GUI and added a label and a button to the first tab. The problem I'm having is the label and button do not show up unless you view another tab first then go back to the first tab. I have looked at the help file and searched the forums here and I believe I'm doing everything correctly. Please see my code below: #include <GUIConstantsEx.au3> $GUI_Main = GuiCreate("Test", 400, 400) GUISetState(@SW_SHOW, $GUI_Main) $tabs = GuiCtrlCreateTab(10, 90, 380, 300) GuiCtrlCreateTabItem("Tab1") $label1 = GUICtrlCreateLabel("Label1", 14, 180, 50, 20) $btn1 = GUICtrlCreateButton("Button1", 14, 120, 100) GuiCtrlCreateTabItem("Tab2") GuiCtrlCreateTabItem("Tab3") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Link to comment Share on other sites More sharing options...
andygo Posted September 10, 2009 Share Posted September 10, 2009 (edited) just move this line from red to green:#include <GUIConstantsEx.au3>$GUI_Main = GuiCreate("Test", 400, 400)GUISetState(@SW_SHOW, $GUI_Main)$tabs = GuiCtrlCreateTab(10, 90, 380, 300)GuiCtrlCreateTabItem("Tab1")$label1 = GUICtrlCreateLabel("Label1", 14, 180, 50, 20)$btn1 = GUICtrlCreateButton("Button1", 14, 120, 100)GuiCtrlCreateTabItem("Tab2")GuiCtrlCreateTabItem("Tab3") GUISetState(@SW_SHOW, $GUI_Main)While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoopWEnd Edited September 10, 2009 by andygo Link to comment Share on other sites More sharing options...
quake101 Posted September 10, 2009 Author Share Posted September 10, 2009 (edited) I found my problem.... GUISetState(@SW_SHOW, $GUI_Main) was in the wrong location.... (It's been one of them days.. arg) Edited September 10, 2009 by quake101 Link to comment Share on other sites More sharing options...
martin Posted September 11, 2009 Share Posted September 11, 2009 I found my problem.... GUISetState(@SW_SHOW, $GUI_Main) was in the wrong location.... (It's been one of them days.. arg) @andygo and quake101 You are both wrong. The fault was that the tab definitions were not ended which is essential or you will get all sorts of problems. Try this #include <GUIConstantsEx.au3> $GUI_Main = GuiCreate("Test", 400, 400) GUISetState(@SW_SHOW, $GUI_Main);it doesn't matter where you have the line to show the gui $tabs = GuiCtrlCreateTab(10, 90, 380, 300) $tab1 = GuiCtrlCreateTabItem("Tab1") $label1 = GUICtrlCreateLabel("Label1", 14, 180, 50, 20) $btn1 = GUICtrlCreateButton("Button1", 14, 120, 100) GuiCtrlCreateTabItem("Tab2") GuiCtrlCreateTabItem("Tab3") GuiCtrlCreateTabItem("");end the tab definition, you must do this GuiCtrlSetState($tab1,$GUI_SHOW);set tab1 to be shown While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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