[Closed] .net spinner?
Always one of those things isnt it, you look for ever and as you hit send you get a strock of gunius and know what you should be looking for.
dotNetControl spinMe "system.windows.forms.numericUpDown"
Now that I have it working how do I set the value property? It wants a System.Decimal what I have is s system.int32, so how do I convert the int32 to the decimal value that the spinner is looking for?
Hi Paul,
You can construct a System.Decimal from an Int32:
http://msdn.microsoft.com/en-us/library/hk63d62d(VS.80).aspx
decimalValue = dotNetObject "System.Decimal" 5
But it is not really needed:
rollout NumericUpDownTestRollout "" height:50 width:80
(
dotNetControl upDown "System.Windows.Forms.NumericUpDown" align:#center height:50 width:50
on NumericUpDownTestRollout open do
(
upDown.Value = 50
upDown.Maximum = 100
upDown.Minimum = 0
)
)
createdialog NumericUpDownTestRollout
I’m getting errors in 2008 doing that. I will have a poke at it again but I also couldn’t construct a system.decimal without error as well.
The following seems to work…
<updownthing>.value = dotNetObject "System.Decimal" (dotNetObject "System.Int32" 15)
Oh ans for what it’s worth – yep, that seems to be a discrepancy between 3ds Max 2008 and 2009; must be some value conversions they fixed for 2009… no matter.
Seems to be an issue with dotnet in max 2008, Paul, it doesn’t cast native maxscript values to the correct dotnet object, however it works in 2009. best way for compatibilty is that the way Richard and Yannick described as it works in both.
Ok, Richards works in 2008, honestly thought that I had tried it but I guess not. Yanniks solution does not using the first line that he posted. Complains that it is an int64 and that it needs a UInt64.
Thanks for the help guys.