steht eigendlich alles im titel
wie mausklick auf menuitem inner autoit gui registrieren
-
- [ offen ]
-
computerfritze -
28. Juli 2007 um 20:55 -
Geschlossen -
Erledigt
-
-
naja ganz normal Abfragen
[autoit]$Menu_file = GUICtrlCreateMenu("File")
[/autoit]
$Menu_close = GUICtrlCreateMenuItem("Close", $Menu_file)und unten dann
[autoit]If $Msg = $Menu_close Then _exit()
[/autoit] -
Spoiler anzeigen
[autoit]$msg1 = GUIGetMsg(1)
[/autoit]
If $msg1 = $MenuItem2 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf
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)
[/autoit]
If $msg1[0] = $MenuItem2 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf
[autoit]
Es reicht aber auch:msg1 = GUIGetMsg()
[/autoit]
If $msg1= $MenuItem2 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf -
Spoiler anzeigen
[autoit]$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem2 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem3 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem15 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem16 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem8 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem9 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem13 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem11 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIf$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
If $msg = $MenuItem12 Then
MsgBox(0, "Mitteilung", "Funktion leider noch nicht implementiert")
EndIfWhile 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitEndSwitch
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
WEnd
[/autoit]
While 1
Local $nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
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
So könnte es aussehen :tongue:
Spoiler anzeigen
[autoit]#include<GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]GUICreate("My GUI")
[/autoit]
$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