Canvas - #PB_EventType_ModifierUp

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Canvas - #PB_EventType_ModifierUp

Post 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.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Canvas - #PB_EventType_ModifierUp

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Canvas - #PB_EventType_ModifierUp

Post 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. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Canvas - #PB_EventType_ModifierUp

Post 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
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply