All I want to do is this: When the User clicks a button, a value is set in a TextGadget (1). If the CTRL key is being held down at the time, a different value is set (100). Fail Snippet:
Code: Select all
Enumeration
#Win
#Btn
#Txt
EndEnumeration
Procedure Win()
;-------------
If OpenWindow(#Win,0,0,150,150,"Win",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(#Txt, 50, 20, 50, 25, "0", #PB_Text_Center|#PB_Text_Border)
ButtonGadget(#Btn, 50, 70, 50, 50, "Btn")
AddKeyboardShortcut(#Win, #PB_Shortcut_Control, #Btn)
EndIf
EndProcedure
Win()
iVal = 1
Repeat
iEvent = WaitWindowEvent()
Select iEvent
Case #PB_Event_Menu: If(EventMenu() = #Btn) : iVal = 100 : EndIf
Case #PB_Event_Gadget
If(EventGadget() = #Btn)
SetGadgetText(#Txt,Str(iVal))
iVal = 1
EndIf
EndSelect
Until iEvent = #PB_Event_CloseWindow
EndEdit2: This works, at the top of the loop (without PB shortcut):
Code: Select all
If GetAsyncKeyState_(#VK_CONTROL | #Btn) : iVal = 100 : Else : iVal = 1 : EndIf

