Notifications
Clear all
[Closed] dotNet checkButton help
Jan 19, 2018 8:49 am
Hello guys.
I need some help to understand how dotNet radiobutton (or checkbox) can be used with maxscript. MXS is quite new for me…
So i am trying to change the interface of a standard UI done with maxscript using dotNet and i don’t know how to change the states for a radiobutton.
For example:
This is a simple script using just the mxs lang:
try (destroydialog TestMXS) Catch()
rollout TestMXS "TestMXS" width:210
(
Fn functionA = (print "Check Button enable")
Fn functionB = (print "Check Button disable")
Fn functionC = (print "Button was pressed")
checkbutton chkBtn01 "Check Button 01" pos:[1,10] width:200 height:20
button Btn01 "Button 01" pos:[1,30] width:200 height:20
on chkBtn01 changed state do
(
if state then
functionA()
else
functionB()
)
on Btn01 pressed do
(
functionC()
)
)
createdialog TestMXS
and i want to change, using dotNet, into something like this:
try (destroydialog TestDotNet) Catch()
rollout TestDotNet "TestDotNet" width:210
(
Fn functionA = (print "Check Button enable")
Fn functionB = (print "Check Button disable")
Fn functionC = (print "Button was pressed")
dotNetControl chkBtn01 "RadioButton" pos:[1,10] width:200 height:20
dotNetControl Btn01 "Button" pos:[1,30] width:200 height:20
on TestDotNet open do
(
chkBtns = #(chkBtn01,Btn01)
chkBtns.flatstyle = (dotNetclass "System.Windows.Forms.FlatStyle").Flat
chkBtns[1].Appearance = chkBtns[1].Appearance.Button
chkBtns[1].text = "Check Button 01"
chkBtns[2].text = "Button 01"
)
on chkBtn01 checked do -- this is not working. What is the correct way?
(
if state then
functionA()
else
functionB()
)
on Btn01 click do
(
functionC()
)
)
createdialog TestDotNet
Thank you !
1 Reply
Jan 19, 2018 8:49 am
Ok. Thanks to Bobo I’ve solved the problem with this:
on chkBtn01 CheckStateChanged do
(
if chkBtn01.checked then
functionA()
else
functionB()
)
https://www.scriptspot.com/bobo/mxs9/dotNet/dotNetObject_System.Windows.Forms.CheckBox.html
Thanks.
-Mihai.