Jump to content

buttons wont show on first time


Recommended Posts

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
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...