Funktion auf Tabitem

  • Hallo
    hab mal wieder ein Problem für welche ich keine Lösung finde. Ich wollte eben eine Funktion schrieben, welche über ein Hotkey aktiviert wird, jedoch nur ausgeführt wird, wenn ein bestimmter Tab (GUICreateTabItem) aktivert ist.
    Würde mich freuen wenn jmd von euch eine Lösung dafür parat hätte :)
    danke im voraus
    mfg

    ps.: da ich keine Ahnung habe ich ich das machen könnte hab ich auch kein Script hier welche nur noch verbessert werden müsste. Das Script sollte dann so ähnlich aussehen, glaube ich zumindest:

    [autoit]


    Hotkeyset("{ENTER}", "Text")
    .
    .
    .
    func text()
    if ???? then
    send("<br>")
    Else
    (Normale Funktion der Entertaste)
    endif
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von descent (8. Juli 2009 um 23:23)

  • Hallo,

    hier is mal das Beispiel aus der Hilfe:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    Opt('MustDeclareVars', 1)

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

    Example()

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

    Func Example()
    Local $tab, $tab0, $tab0OK, $tab0input
    Local $tab1, $tab1combo, $tab1OK
    Local $tab2, $tab2OK, $msg

    GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered

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

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

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

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

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

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

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

    $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)

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

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

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

    GUICtrlCreateTabItem(""); end tabitem definition

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

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

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

    GUISetState()

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

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

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

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $tab Then
    ; display the clicked tab
    WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab))
    EndIf
    WEnd
    EndFunc ;==>Example

    [/autoit]


    Hierbei wird mit

    [autoit]

    GUICtrlRead($tab)

    [/autoit]


    der Index des gerade angeklickten Tabitems ermittelt.

    mfg
    hulle