Sign in to follow this  
Followers 0
quake101

Tabs Problem

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 ExitLoop

WEnd

Edited by andygo

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I found my problem.... GUISetState(@SW_SHOW, $GUI_Main) was in the wrong location.... :D (It's been one of them days.. arg)

Edited by quake101

Share this post


Link to post
Share on other sites

I found my problem.... GUISetState(@SW_SHOW, $GUI_Main) was in the wrong location.... :D (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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0