Tab Abfrage

  • Hallo zusammen,

    ich habe mal wiedr ein TAB Problem.
    In der Hilfe bin ich nicht weitergekommen.

    Folgendes:
    Wenn ich z.B. 10 oder 20 TABS fertig habe,
    wie kann ich ermitteln:

    1. Welcher TAB den Fokus hat (also nicht nur per Klick sondern auch per Tastatur)

    Also sobald irgend ein TAB aktiv ist (den Fokus hat) Msgbox z.B. TAB 4 aktviert!

    Hier mal das Script aus der Hilfe

    Spoiler anzeigen
    [autoit]


    #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GuiConstantsEx.au3>
    #include <GuiTab.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $hTab

    [/autoit] [autoit][/autoit] [autoit]

    ; Create GUI
    GUICreate("Tab Control Get Current Focus", 400, 300)
    $hTab = GUICtrlCreateTab(2, 2, 396, 296)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    ; Add tabs
    _GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
    _GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
    _GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

    ; Get/Set current focus
    _GUICtrlTab_SetCurFocus($hTab, 1)
    MsgBox(4160, "Information", "Current Focus: " & _GUICtrlTab_GetCurFocus($hTab))

    [/autoit] [autoit][/autoit] [autoit]

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
    EndFunc ;==>_Main

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    Wenn ich z.B. 5 oder 20 Tabs ... habe
    müssen diese dann zuerst ermittelt werden???


    Liebe Grüße
    ;) Ilse

    Einmal editiert, zuletzt von Ilse (20. März 2012 um 13:55)

  • Hä, ich seh grad iwie das Problem nicht...
    Vielleicht kannst du nochma genauer erklären, was du machen willst.
    Vielleicht so(?):

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GuiConstantsEx.au3>
    #include <GuiTab.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $hTab

    [/autoit] [autoit][/autoit] [autoit]

    ; Create GUI
    GUICreate("Tab Control Get Current Focus", 400, 300)
    $hTab = GUICtrlCreateTab(2, 2, 396, 296)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    ; Add tabs
    _GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
    _GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
    _GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Loop until user exits
    While 1
    Local $nGuiMsg = GUIGetMsg()
    Switch $nGuiMsg
    Case $GUI_EVENT_CLOSE
    ExitLoop
    Case $hTab
    MsgBox(0, "", "TAB " & _GUICtrlTab_GetCurFocus($hTab) & " aktiviert!")
    EndSwitch
    WEnd
    GUIDelete()
    EndFunc ;==>_Main

    [/autoit]