Sign in to follow this  
Followers 0
Simon66

Creating Item inside a Tab?

3 posts in this topic

#1 ·  Posted (edited)

So I made a little script that plays a game, It's only like 5 lines. But the thing is I want to add another game to my program. So I made a new Tab.

Now the thing is. How can I create a new that, that when the user clicks on that one, a new button will show.

Here is my code so far

#include <GUIConstantsEx.au3>

#Region ### Start Hotkeys section ###
HotKeySet("{a}","_Start")
HotKeySet("{s}","_Pause")
HotKeySet("{d}","_Exit")
#endregion ### End Hotkeys section ###


#Region ### START Koda GUI section ###
GUICreate("Arcade -Simon66", 300, 100)
GUISetState(@SW_SHOW)
$startButton = GUICtrlCreateButton("Start", 10, 10, 60)
$stopButton  = GUICtrlCreateButton("Stop" , 70, 10, 60)
GuiCtrlCreateTab( -2, -2, 305, 105)
GUICtrlCreateTabItem("Ping")
GUICtrlCreateTabItem("Brick Breaker")
#EndRegion ### END Koda GUI section ###

Global $Active = -1

while 1
    
    $msg = GUIGetMsg()
    
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $startButton
            while 1
                if $Active = 1 Then
                    $BallPosition = PixelSearch(468,545,585,725,0xFF0000,1)
                    if IsArray($BallPosition) Then
                        MouseMove($BallPosition[0],$BallPosition[1],1)
                    EndIf
                EndIf
            WEnd
    EndSwitch
WEnd

Func _Start()
    $Active = 1
EndFunc
Func _Pause()
    $Active = 0
EndFunc
Func _Exit()
    Exit
EndFunc

So on tab Ping I'll have Start and Stop and on tab Brick Breaker I just want a button that says Hide.

Thank you

Edited by Simon66

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GUIConstantsEx.au3>

#Region ### Start Hotkeys section ###
HotKeySet("{a}","_Start")
HotKeySet("{s}","_Pause")
HotKeySet("{d}","_Exit")
#endregion ### End Hotkeys section ###


#Region ### START Koda GUI section ###
GUICreate("Arcade -Simon66", 300, 100)
GUISetState(@SW_SHOW)
$startButton = GUICtrlCreateButton("Start", 10, 10, 60) ;; These two buttons should probably be moved onto your first tab by moving them below the "Ping" tabitem
$stopButton  = GUICtrlCreateButton("Stop" , 70, 10, 60)
GuiCtrlCreateTab( -2, -2, 305, 105);<< check your positioning.
GUICtrlCreateTabItem("Ping")
$nextButton = GUICtrlCreateButton("something", 10,,,.......
$Btn_4 = GUICtrlCreateButton("something Else", 10,,,.......
GUICtrlCreateTabItem("Brick Breaker")
$lastBtn = GUICtrlCreateButton("last", 10,,,.......
GUICtrlCreateTabItem("") ;;<<<<< Don't forget to close your tab with a null item.
#EndRegion ### END Koda GUI section ###

Global $Active = -1

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>

#Region ### Start Hotkeys section ###
HotKeySet("{a}","_Start")
HotKeySet("{s}","_Pause")
HotKeySet("{d}","_Exit")
#endregion ### End Hotkeys section ###


#Region ### START Koda GUI section ###
GUICreate("Arcade -Simon66", 300, 100)
GUISetState(@SW_SHOW)
$startButton = GUICtrlCreateButton("Start", 10, 10, 60) ;; These two buttons should probably be moved onto your first tab by moving them below the "Ping" tabitem
$stopButton  = GUICtrlCreateButton("Stop" , 70, 10, 60)
GuiCtrlCreateTab( -2, -2, 305, 105);<< check your positioning.
GUICtrlCreateTabItem("Ping")
$nextButton = GUICtrlCreateButton("something", 10,,,.......
$Btn_4 = GUICtrlCreateButton("something Else", 10,,,.......
GUICtrlCreateTabItem("Brick Breaker")
$lastBtn = GUICtrlCreateButton("last", 10,,,.......
GUICtrlCreateTabItem("") ;;<<<<< Don't forget to close your tab with a null item.
#EndRegion ### END Koda GUI section ###

Global $Active = -1

Thank you... Ye, for the tab the positioning is right. I want it to overlap the main GUI.

Thank you again.

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