wie mausklick auf menuitem inner autoit gui registrieren

  • naja ganz normal Abfragen

    [autoit]

    $Menu_file = GUICtrlCreateMenu("File")
    $Menu_close = GUICtrlCreateMenuItem("Close", $Menu_file)

    [/autoit]

    und unten dann

    [autoit]

    If $Msg = $Menu_close Then _exit()

    [/autoit]
  • Spoiler anzeigen
    [autoit]

    $msg1 = GUIGetMsg(1)
    If $msg1 = $MenuItem2 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

    [/autoit]


    so siehts jetzt aus , funzt aber immer noch nicht
    das oberere ist klar

  • Hi,
    hab zwar noch nie was mit einem Menü gemacht, lasse mal die 1 in der Klammer bei $msg1 = GUIGetMsg(1) weg.

    Wenns nicht geht poste bitte mal den kompletten Code ;)

  • wenn du da GUIGetMsg(1) hast musst du noch bei deiner If Abfrage nach der GUI fragen auf welcher sich das Element befindet

    • Offizieller Beitrag

    GUIGetMsg(1) ist die erweiterte Form. Du bekommst ein Array zurück:
    $array[0] = 0 or Event ID or Control ID
    $array[1] = The window handle the event is from
    $array[2] = The control handle the event is from (if applicable)
    $array[3] = The current X position of the mouse cursor (relative to the GUI window)
    $array[4] = The current Y position of the mouse cursor (relative to the GUI window)

    Für dein Muster:

    [autoit]

    msg1 = GUIGetMsg(1)
    If $msg1[0] = $MenuItem2 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

    [/autoit]


    Es reicht aber auch:

    [autoit]

    msg1 = GUIGetMsg()
    If $msg1= $MenuItem2 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

    [/autoit]
  • Tweaky

    Spoiler anzeigen
    [autoit]

    $msg = GUIGetMsg()
    If $msg = $MenuItem2 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem3 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem15 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem16 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem8 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem9 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem13 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem11 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    $msg = GUIGetMsg()
    If $msg = $MenuItem12 Then
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndIf

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    EndSwitch
    WEnd

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


    While 1
    Local $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]


    BugFix
    geht leider auch nicht

  • Guck Dir in der Hilfe mal Switch...Case...EndSwitch oder Select...Case...EndSelect an. Dann noch While...WEnd. Vor allem die Beispiele werden Dir helfen, Dein Problem zu lösen. Es ist wirklich nicht so schwer.

    Mein Tipp: Schieb alle If-Abfragen in eine(!) While-Schleife und frag die mit Select ab. Die If-Abfragen außerhalb einer Schleife helfen Dir nicht, da das Script die für den Bruchteil einer Sekunde abfragt und dann weiter macht.

  • Bitte nächstes mal das komplette Script ;-), hier fehlte z. B. das erstellen der GUI :D

    So könnte es aussehen :tongue:

    Spoiler anzeigen
    [autoit]

    #include<GUIConstants.au3>

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

    GUICreate("My GUI")
    $Menu_file = GUICtrlCreateMenu("File")
    $Menu_close = GUICtrlCreateMenuItem("Close", $Menu_file)
    $MenuItem2 = GUICtrlCreateMenuItem("111", $Menu_file)
    GUISetState ()

    While 1
    $Msg = GUIGetMsg()
    Select
    Case $Msg = $GUI_EVENT_CLOSE
    Exit
    Case $msg = $Menu_close
    MsgBox(0, "Exit", "Exit")
    Exit
    Case $msg = $MenuItem2
    MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
    EndSelect
    WEnd

    [/autoit]