Notifications
Clear all

[Closed] dotnet MouseWheel event not detected with windows10

I just has a question about an issue I’ve been struggling with for a few days now. Back when I was on windows7, I made heavy use of a struct that uses a dotnet control interface to detect mousewheel events. This struct was made by a guy called Ofer Zelichover (www.oferz.com).

Anyhow, “cont MouseWheel sender event” is nolonger working with windows10. Any ideas on how I can fix this?


rollout ro_MouseWheel "test" 
(
	-- Local Variable Definitions
	--------------------------------------
	local onChangeFn, onActivateFn, onDeActivateFn
	local isActive = false
	local msg = false
	local divider = 120.
	local persistentWin = false
	local alt = false, ctrl = false, shift = false
	local keyValue = undefined
	local invalidKeyValues = #{16..18}
	local sticky = true
	
	dotNetControl cont "System.Windows.Forms.Control" pos:[0,0] -- User Interface
	
	function stop =
	(
		if persistentWin then (
			cont.enabled = false
		)
		else
			try(destroyDialog ro_MouseWheel)catch()
	)
	
	function init =
	(
		if isKindOf onActivateFn MAXScriptFunction then 
			onActivateFn()
		isActive = true
		enableAccelerators = false
		cont.enabled = true
		cont.focus()
	)
	
	function done =
	(
		keyValue = undefined
		if msg then (
			popPrompt()
			msg = false
		)
		isActive = false
		enableAccelerators = true
		if isKindOf onDeActivateFn MAXScriptFunction then 
			onDeActivateFn()
	)

	/*===========================================
	Event Handlers
	===========================================*/
	on cont MouseWheel sender event do (
		print "MouseWheel"
		if isKindOf onChangeFn MAXScriptFunction then (
			onChangeFn (event.delta / divider) alt:alt ctrl:ctrl shift:shift
		)
	)
	on cont lostFocus do (
		print "lostFocus"
		if not persistentWin then
			try (destroyDialog ro_MouseWheel)catch()
		else
			done()
	)
	on cont KeyDown sender event do (
		print "KeyDown"
		if sticky then (
			if keyValue == undefined and not invalidKeyValues[event.KeyValue] then
				keyValue = event.KeyValue
		)
		if( event.KeyValue == 88 ) do
		(
			try( toggleFunc() )
			catch( print( "ERROR: No toggleFunc declared!!!" ) )
		)
		alt = event.Alt
		ctrl = event.Control
		shift = event.Shift
		event.SuppressKeyPress = true
		event.Handled = false
	)
	on cont KeyUp sender event do (
		if sticky then (
			if keyValue == event.KeyValue then
				stop()
		)
		alt = event.Alt
		ctrl = event.Control
		shift = event.Shift
		
		event.SuppressKeyPress = true
		event.Handled = false
	)

	on ro_MouseWheel open do (
		print "Init"
		init()
	)
	
	on ro_MouseWheel close do (
		print "Close"
		done()
	)
)

1 Reply

It could be because of this… we’ve turned it off as we ran into a number of issues where scrolling a rollout with mouse wheel would change the selection in a dropdownlist.

https://www.thurrott.com/windows/windows-10/2435/windows-10-tip-scroll-inactive-windows