Jump to content
Sign in to follow this  
cation

buttons wont show on first time

Recommended Posts

cation

hi guys, im wondering why those buttons 1 and 2 wont show when starting this script, they will appear when switch to tab lallel and then back to lollil. heres my code, and sorry if there is already thread like this :)

#include 

Global $aTitle[5] = [5, "lol", "lil", "lal", "lel"]
Global $aButton[5]

$form1 = GUICreate("test", 400, 125)
GUICtrlCreateTab(10, 10, 380, 100)


GUISetState(@SW_SHOW)

GUICtrlCreateTab(10, 10, 200, 100)

GUICtrlCreateTabItem("lollil")
$abutton[1] = GUICtrlCreateButton("lol", 20, 50, 50)
$abutton[2] = GUICtrlCreateButton("lil", 20, 75, 50)

GUICtrlCreateTabItem("lallel")
$abutton[3] = GUICtrlCreateButton("lal", 20, 50, 50)
$abutton[4] = GUICtrlCreateButton("lel", 20, 75, 50)


GUISetState()

While 1
$iMsg = GUIGetMsg()
Switch $iMsg
Case $abutton[1]
MsgBox(0, "", "lol")
Case $abutton[2]
MsgBox(0, "", "lil")
Case $abutton[3]
MsgBox(0, "", "lal")
Case $abutton[4]
MsgBox(0, "", "lel")
EndSwitch
If $iMsg = $GUI_EVENT_CLOSE Then Exit
WEnd
Edited by cation

Share this post


Link to post
Share on other sites
water

Try this:

#include <GUIConstantsEx.au3>
Global $aTitle[5] = [5, "lol", "lil", "lal", "lel"]
Global $aButton[5]
$form1 = GUICreate("test", 400, 125)
GUICtrlCreateTab(10, 10, 380, 100)

GUISetState(@SW_SHOW)
GUICtrlCreateTab(10, 10, 200, 100)
$tab1 = GUICtrlCreateTabItem("lollil") ; <== changed
$aButton[1] = GUICtrlCreateButton("lol", 20, 50, 50)
$aButton[2] = GUICtrlCreateButton("lil", 20, 75, 50)
GUICtrlCreateTabItem("lallel")
$aButton[3] = GUICtrlCreateButton("lal", 20, 50, 50)
$aButton[4] = GUICtrlCreateButton("lel", 20, 75, 50)
GUICtrlCreateTabItem("") ; <== added according to the help file
GUICtrlSetState($tab1, $GUI_SHOW) ; <== added according to the help file
GUISetState()
While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $aButton[1]
            MsgBox(0, "", "lol")
        Case $aButton[2]
            MsgBox(0, "", "lil")
        Case $aButton[3]
            MsgBox(0, "", "lal")
        Case $aButton[4]
            MsgBox(0, "", "lel")
    EndSwitch
    If $iMsg = $GUI_EVENT_CLOSE Then Exit
WEnd

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water
:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.