PDA

View Full Version : .net spinner?


PEN
10-17-2008, 08:49 PM
Is there a dotNet control that looks like a Max spinner?

PEN
10-17-2008, 08:53 PM
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"

PEN
10-17-2008, 10:29 PM
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?

ypuech
10-17-2008, 10:59 PM
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

PEN
10-18-2008, 04:36 PM
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.

ZeBoxx2
10-18-2008, 07:17 PM
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.

PEN
10-19-2008, 07:23 PM
I'll try that again, something I was doing wrong I guess. Thanks guys.

LoneRobot
10-19-2008, 09:11 PM
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.

PEN
10-20-2008, 11:43 AM
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.

CGTalk Moderation
10-20-2008, 11:43 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.