dotNet checkButton help

Hello guys.
I need some help to understand how dotNet radiobutton 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 !

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

I don't know why you want to use DotNet radiobuttons as a checkbuttons, but...

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 chkBtn02 "RadioButton" pos:[1,30] width:200 height:20
dotNetControl Btn01 "Button" pos:[1,50] width:200 height:20	
 
on TestDotNet open do
	(
		chkBtns = #(chkBtn01,chkBtn02,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 = "Check Button 03"
		chkBtns[3].text = "Button 01"
	)
 
 
	on chkBtn01 CheckedChanged e do
	(
		if chkBtn01.checked do
			chkBtn02.checked = false
	)
	on chkBtn02 CheckedChanged e do
	(
		if chkBtn02.checked do
			chkBtn01.checked = false
	)
 
	on Btn01 click do
	(	
		functionC() 
	)	
)
createdialog TestDotNet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.