Button Doppelklick in GUICtrlCreateTab

  • Hallo AutoIT Fans,


    mein Problem ist Doppelklick auf Button in AutoIt GUI. Wenn ich der der GUI ein TAB habe kann ich ohne probleme den Doppelklick unterdrücken, siehe Code:


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TabConstants.au3>
    #include <WindowsConstants.au3>

    Opt("GUIOnEventMode", 1)


    $Form1 = GUICreate("Form1", 633, 447, 192, 124)
    $Tab1 = GUICtrlCreateTab(48, 48, 545, 369)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
    GUICtrlSetState(-1,$GUI_SHOW)
    $Button1 = GUICtrlCreateButton("Button1", 184, 184, 145, 81, 0)
    GUICtrlSetOnEvent($Button1, "Button1")
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    While 1
    sleep(1000)
    WEnd


    Func Button1()
    GUICtrlSetState(-1, $GUI_DISABLE)
    sleep(100)
    Run("notepad.exe", "", @SW_MINIMIZE)
    GUICtrlSetState(-1, $GUI_ENABLE)
    EndFunc


    wenn ich aber mehrere TABs erstelle, wird der Doppellick nicht mehr ausgewertet, siehe Code:


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TabConstants.au3>
    #include <WindowsConstants.au3>

    Opt("GUIOnEventMode", 1)


    $Form1 = GUICreate("Form1", 633, 447, 192, 124)
    $Tab1 = GUICtrlCreateTab(48, 48, 545, 369)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
    GUICtrlSetState(-1,$GUI_SHOW)
    $Button1 = GUICtrlCreateButton("Button1", 184, 184, 145, 81, 0)
    GUICtrlSetOnEvent($Button1, "Button1")
    $TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
    $Button2 = GUICtrlCreateButton("Button2", 224, 192, 145, 89, 0)
    $TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
    $Button3 = GUICtrlCreateButton("Button3", 232, 160, 185, 113, 0)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    While 1
    sleep(1000)
    WEnd


    Func Button1()
    GUICtrlSetState(-1, $GUI_DISABLE)
    sleep(100)
    Run("notepad.exe", "", @SW_MINIMIZE)
    GUICtrlSetState(-1, $GUI_ENABLE)
    EndFunc


    Hat jemand eine Idee, wie mann den Doppelklick bei mehreren TABs auch unterdrücken kann???


    Gruß

    753713

  • Zitat
    [autoit]

    GUICtrlSetState(-1, $GUI_DISABLE)

    [/autoit]

    -1 ist immer das zuletzt erstellte Control. Du deaktivierst also ein TabItem, nicht den Button
    Machs doch einfach so:

    Spoiler anzeigen
    [autoit]

    Func Button1()
    GUICtrlSetState($Button1, $GUI_DISABLE)
    Sleep(100)
    Run("notepad.exe", "", @SW_MINIMIZE)
    GUICtrlSetState($Button1, $GUI_ENABLE)
    EndFunc ;==>Button1

    [/autoit]

    Oder so:

    Spoiler anzeigen
    [autoit]

    Func Button1()
    GUICtrlSetState(@GUI_CtrlId, $GUI_DISABLE)
    Sleep(100)
    Run("notepad.exe", "", @SW_MINIMIZE)
    GUICtrlSetState(@GUI_CtrlId, $GUI_ENABLE)
    EndFunc ;==>Button1

    [/autoit]