Page 1 of 1

Canvas - #PB_EventType_ModifierUp

Posted: Tue May 13, 2014 6:47 am
by J. Baker
#PB_EventType_ModifierUp could come in handy. That way it could be used like "Case #PB_EventType_ModifierUp". ;)

Otherwise you have to wait for a mouse movement to see if a modifier has been released.

Re: Canvas - #PB_EventType_ModifierUp

Posted: Tue May 13, 2014 7:49 am
by STARGĂ…TE
you can use #PB_EventType_KeyUp

Code: Select all

Enumeration
	#Window
	#Gadget
EndEnumeration


OpenWindow(#Window, 0, 0, 800, 600, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
CanvasGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), #PB_Canvas_Keyboard)


Repeat
	
	Select WaitWindowEvent()
			
		Case #PB_Event_CloseWindow
			End
			
		Case #PB_Event_Gadget
			Select EventGadget()
				Case #Gadget
					Select EventType()
						Case #PB_EventType_KeyDown
							Debug GetGadgetAttribute(#Gadget, #PB_Canvas_Modifiers)
						Case #PB_EventType_KeyUp
							Debug GetGadgetAttribute(#Gadget, #PB_Canvas_Modifiers)
					EndSelect
			EndSelect
			
	EndSelect
	
ForEver

Re: Canvas - #PB_EventType_ModifierUp

Posted: Tue May 13, 2014 8:14 am
by J. Baker
Thanks but that doesn't work on OS X. Must be a bug. Which is weird because I thought I had tested the #PB_EventType_KeyUp and it worked with a few keys I tested, just not Shift. So I assumed the "Modifiers" didn't work with #PB_EventType_KeyUp.

I was using, "If GetGadgetAttribute(1, #PB_Canvas_Modifiers) = #PB_Canvas_Shift" without the #PB_Canvas_Keyboard flag which works and is nice because then it doesn't effect my keyboard shortcuts.

Thanks again for trying to help though. ;)

Re: Canvas - #PB_EventType_ModifierUp

Posted: Tue May 13, 2014 8:58 am
by J. Baker
I was actually able to rework my app to function differently and no longer need to check if the modifier was released or not. :D