I need in my code to get popup dialog with focus as result of selected key sequence. The focus is important because I want the dialog to disappear when it loses focus I tried something like this (a left Shift + left WinKey recalls popup):
Code: Select all
Procedure PopupDlg()
If #False = OpenWindow(0,
300, 300,
150, 150,
"Popup test",
#PB_Window_Tool)
ProcedureReturn
EndIf
SetWindowPos_(WindowID(0),
#HWND_TOPMOST,
0, 0, 0, 0,
#SWP_NOMOVE |
#SWP_NOSIZE);
SetActiveWindow_(WindowID(0))
Repeat
Until #PB_Event_DeactivateWindow = WaitWindowEvent()
CloseWindow(0)
EndProcedure
cnt = 0
Repeat
Delay(100)
cnt = cnt + 1
If GetKeyState_(#VK_LWIN) & $8000
If #False = KeyPrev
; Left WinKey pressed
KeyPrev = #True
If GetKeyState_(#VK_LSHIFT) & $8000
; With Shift
PopupDlg()
ElseIf GetKeyState_(#VK_LCONTROL) & $8000
; With Ctrl
End
EndIf
EndIf
Else
KeyPrev = #False
EndIf
Until cnt = 600 ; One minute limit