Sign in to follow this  
Followers 0
chun914

on event mode

5 posts in this topic

how can i perform the winsettitle function in a on event mode

#include <GUIConstants.au3>
GUICreate("My GUI Tab",250,150); will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab=GUICtrlCreateTab (10,10, 200,100)

$tab0=GUICtrlCreateTabitem ("tab0")
GUICtrlCreateLabel ("label0", 30,80,50,20)
$tab0OK=GUICtrlCreateButton ("OK0", 20,50,50,20)
$tab0input=GUICtrlCreateInput ("default", 80,50,70,20)

$tab1=GUICtrlCreateTabitem ( "tab----1")
GUICtrlCreateLabel ("label1", 30,80,50,20)
$tab1combo=GUICtrlCreateCombo ("", 20,50,60,120)
GUICtrlSetData(-1,"Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK=GUICtrlCreateButton ("OK1", 80,50,50,20)

$tab2=GUICtrlCreateTabitem ("tab2")
GUICtrlSetState(-1,$GUI_SHOW); will be display first
GUICtrlCreateLabel ("label2", 30,80,50,20)
$tab2OK=GUICtrlCreateButton ("OK2", 140,50,50)

GUICtrlCreateTabitem (""); end tabitem definition

GUICtrlCreateLabel ("Click on tab and see the title", 20,130,250,20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    if $msg = $tab then
    ; display the clicked tab
        if GUICtrlread ($tab) = 0 then WinSetTitle("My GUI Tab","","My GUI Tab0")
        if GUICtrlread ($tab) = 1 then WinSetTitle("My GUI Tab","","My GUI Tab1")
        if GUICtrlread ($tab) = 2 then WinSetTitle("My GUI Tab","","My GUI Tab2")
    EndIf
Wend

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GUIConstantsEx.au3>
GUICreate("My GUI Tab",250,150); will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab=GUICtrlCreateTab (10,10, 200,100)

$tab0=GUICtrlCreateTabitem ("tab0")
GUICtrlCreateLabel ("label0", 30,80,50,20)
$tab0OK=GUICtrlCreateButton ("OK0", 20,50,50,20)
$tab0input=GUICtrlCreateInput ("default", 80,50,70,20)

$tab1=GUICtrlCreateTabitem ( "tab----1")
GUICtrlCreateLabel ("label1", 30,80,50,20)
$tab1combo=GUICtrlCreateCombo ("", 20,50,60,120)
GUICtrlSetData(-1,"Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK=GUICtrlCreateButton ("OK1", 80,50,50,20)

$tab2=GUICtrlCreateTabitem ("tab2")
GUICtrlSetState(-1,$GUI_SHOW); will be display first
GUICtrlCreateLabel ("label2", 30,80,50,20)
$tab2OK=GUICtrlCreateButton ("OK2", 140,50,50)

GUICtrlCreateTabitem (""); end tabitem definition

GUICtrlCreateLabel ("Click on tab and see the title", 20,130,250,20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    if $msg = $tab then
    ; display the clicked tab
        if GUICtrlread ($tab) = 0 then GUICtrlSetData($tab0, "Help")
        if GUICtrlread ($tab) = 1 then GUICtrlSetData($tab1, "Me")
        if GUICtrlread ($tab) = 2 then GUICtrlSetData($tab2, "Please")
    EndIf
Wend
Exit

Edit:

This is totally assuming that you are trying to change the tab and not the title itself... with that, just give GUICreate a variable name $hGUI = GUICreate() and use WinSetTitle($hGUI, "", "My Title")

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

It was the example code from the help file.

when one of the tab is clicked...the wintitle will be changed.

Share this post


Link to post
Share on other sites

Opt('GUIOnEventMode', 1)
$gui = GUICreate('', 200, 200)
    GUISetOnEvent(-3, '_Quit') ; $GUI_EVENT_CLOSE
$tab = GUICtrlCreateTab(5, 5, 190, 190)
    GUICtrlSetOnEvent(-1, '_TabHandler')
$tab1 = GUICtrlCreateTabItem('one')
$tab2 = GUICtrlCreateTabItem('two')
$tab3 = GUICtrlCreateTabItem('three')
GUICtrlCreateTabItem('')
GUISetState()

While 1
    Sleep(1)
WEnd

Func _TabHandler()
    WinSetTitle($gui, '', 'Tab index ' & GUICtrlRead($tab))
EndFunc

Func _Quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Opt('GUIOnEventMode', 1)
$gui = GUICreate('', 200, 200)
    GUISetOnEvent(-3, '_Quit') ; $GUI_EVENT_CLOSE
$tab = GUICtrlCreateTab(5, 5, 190, 190)
    GUICtrlSetOnEvent(-1, '_TabHandler')
$tab1 = GUICtrlCreateTabItem('one')
$tab2 = GUICtrlCreateTabItem('two')
$tab3 = GUICtrlCreateTabItem('three')
GUICtrlCreateTabItem('')
GUISetState()

While 1
    Sleep(1)
WEnd

Func _TabHandler()
    WinSetTitle($gui, '', 'Tab index ' & GUICtrlRead($tab))
EndFunc

Func _Quit()
    Exit
EndFunc

yeah..thanks so much

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