Gibt es eine Möglichkeit das Hotkeyset die Tastenkombi durchlässt?
Z.B. F5 beim aktiven GUI = Neues GUI öffnen wenn aber der Webbrowser offen ist soll "seine" Tastenkombination gelten, also die Seite aktualisieren
Hotkeyset Tastenkombi durchlassen
-
- [ gelöst ]
-
Aquaplant -
19. Januar 2010 um 13:34 -
Geschlossen -
Erledigt
-
-
puh auf die schnelle würd ich mal sagen:
bau in die funktion einfach ne abfrage ein
wenn gui aktiv dann mach das
ansonsten send F5 -
Gute Idee, darauf bin ich noch gar nicht gekommen

-
oder Du kannst die Hotkey-Definition auch zustandsabhängig ändern:
- wenn GUI, dann HotKeySet("{F5}", "_func")
- wenn Browser, dann HotKeySet("{F5}") -->> Zuweisung gelöscht
- wenn wieder GUI aktiv, dann HotKeySet("{F5}", "_func")
-
oder Du kannst die Hotkey-Definition auch zustandsabhängig ändern:
- wenn GUI, dann HotKeySet("{F5}", "_func")
- wenn Browser, dann HotKeySet("{F5}") -->> Zuweisung gelöscht
- wenn wieder GUI aktiv, dann HotKeySet("{F5}", "_func")
jup hatte ich auch erst überlegt. aber das denke ich is doch n gutes stück aufwendiger
-
WIe kann man denn die Zuweisung wieder löschen? Es gibt ja leider keinen Befehl wie Hotkeysetdisable()
-
Hallo Aquaplant,
schau mal auf den 2. Parameter:
Zitataus der dt. Hilfe: function [optional] Der Name der aufzurufenden Funktion. Wird der Parameter nicht angegeben, wird der vorher gesetzte HotKey gelöscht.
mfg (Auto)Bert
-
Es geht einfacher:
[autoit]GUISetAccelerators
[/autoit] -
Ich hab da mal was vorbereitet, das dein Problem lösen kann:
F5 ist aktiv, wenn die GUI im Vordergrund ist;
Mausklick innerhalb der GUI erzeugt eine MsgBox;
Labels zeigen den aktuellen Status an;Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
Global $hwnd, $DLL = DllOpen("user32.dll")
$Form1 = GUICreate("Testgui", 222, 64)
$hwnd = HWnd($Form1)
$Label1 = GUICtrlCreateLabel("Status:", 8, 8, 37, 17)
$Label2 = GUICtrlCreateLabel("Active", 64, 8, 148, 17)
$Label3 = GUICtrlCreateLabel("Label3", 64, 32, 148, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###While 1
[/autoit] [autoit][/autoit] [autoit]
$pos = GUIGetCursorInfo()
$wpos = WinGetPos($hwnd)
_inGUI($pos, $wpos)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitEndSwitch
[/autoit] [autoit][/autoit] [autoit]
If _IsPressed("01", $DLL) Then
If (MouseGetPos(0) > $wpos[0] And MouseGetPos(0) < $wpos[2] + $wpos[0]) = True And (MouseGetPos(1) > $wpos[1] And MouseGetPos(1) < $wpos[3] + $wpos[1]) Then
If IsArray($pos) Then MsgBox(0, "GUI-Info", "Innerhalb der GUI" & @CRLF & $pos[0] & ", " & $pos[1])
EndIf
EndIf
If _IsPressed("74", $DLL) Then
If WinActive($hwnd) = True Then
While _IsPressed("74", $DLL)
Sleep(10)
WEnd
MsgBox(0, "GUI-Info", "F5 wurde gedrückt...!")
EndIf
EndIf
WEndFunc _inGUI($pos, $wpos)
[/autoit]
If GUICtrlRead($Label2) = "Active" And WinActive($hwnd) = False Then
GUICtrlSetData($Label2, "InActive")
ElseIf GUICtrlRead($Label2) = "InActive" And WinActive($hwnd) = True Then
GUICtrlSetData($Label2, "Active")
Else
Sleep(10)
EndIf
If (MouseGetPos(0) > $wpos[0] And MouseGetPos(0) < $wpos[2] + $wpos[0]) = True And (MouseGetPos(1) > $wpos[1] And MouseGetPos(1) < $wpos[3] + $wpos[1]) Then
If GUICtrlRead($Label3) <> "Inside" Then GUICtrlSetData($Label3, "Inside")
Else
If GUICtrlRead($Label3) <> "Outside" Then GUICtrlSetData($Label3, "Outside")
EndIf
EndFunc ;==>_inGUI -
Besser:
[autoit]GUICreate("Test",200,200)
[/autoit]
;Ctrls...
$dummyf5=GUICtrlCreateDummy()
dim $accel[1][2]=[[$dummyf5,"{F5}"]]
GUISetAccelerators($accel)
GUISetState()
While True
Switch GUIGetMsg()
Case $dummyf5
MsgBox(0,"","Funktion")
EndSwitch
WEnd
edit: Fehler behoben -
Diese Lösung finde ich gut (weil sie sehr kurz und knapp ist
)
leider klappt sie bei mir nicht:Zitat(4,34): ERROR: wrong nesting in initializer
dim $accel[1][2]=[$dummyf5,"{F5}"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ -
Fehler behoben (siehe Edit)
-
Hey, super
Dankeschön