Set ISpinnerControl value


#1

Hi i have a bit of a problem setting a spinner value, i can print the value showmethods properties etc but can’t set it.

here it is

fn KeycombSafeframe = (

					local WindowHandle = DialogMonitorOPS.GetWindowHandle()
					local WindowTitle =  (UIAccessor.GetWindowText WindowHandle)
					local g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
					local SpinnerArray = #()

					if WindowTitle == "Viewport Configuration" then (
						
						local parent 
						for i in (windows.getChildrenHWND WindowHandle) where i[4]=="Button" and i[5] == "Live Area" do parent = i[3]
						
						SpinnerArray = for h in (windows.getChildrenHWND WindowHandle) where h[3]== parent and h[4]== "SpinnerControl" collect h
						
						(
							thespinner = g.GetISpinner (dotnetobject "System.IntPtr" SpinnerArray[3][1])
							print thespinner.IVal
							thespinner.SetValue 50.0 1
						--	g.ReleaseISpinner thespinner
						)

					DialogMonitorOPS.unRegisterNotification id:#SafeFrameToggle
					DialogMonitorOPS.enabled = false 
					
					)
					True
				)
		
			DialogMonitorOPS.enabled = true
			DialogMonitorOPS.RegisterNotification KeycombSafeframe id:#SafeFrameToggle
			actionMan.executeAction 0 "40095"

this should set the Action Safe “horizontal” spinner in the safe frame tab
note that i enabled the spinner by hand for now unchecking the “Lock” Checkbox

it wont work either if i send or not the notification param and wether or not i release the control after it
thanks for checking it out


#2

It works correctly in max 2014. If it doesn’t work in your max version try setting the spinner value using UIAccessor.SetWindowText and then sending the VK_RETURN char to the edit control.

-- better way to open the needed vpconfig tab
(dotNetClass "Autodesk.Max.GlobalInterface").Instance.CoreInterface14.DisplayViewportConfigDialogPage 3 -- 'Safe Frames' page index

#3

thank you, it works perfectly this way
maybe because of the dialog that opens in the correct page!

thanks