PDA

View Full Version : DotNet Checkbutton/checkbox


mLichy
04-03-2010, 09:01 PM
Does anyone know how to code this?

I tried this... and it made the checkbox, but now idk how to properly set it's appearance as a button, and then setup the on check/uncheck callbacks.

dotNetControl mCheckbox "system.windows.forms.Checkbox" height:22 width:140

thanks !

Matt

akramparvez
04-04-2010, 04:52 AM
I think this should help you

(
rollout sampleRollout "Sample Rollout"
(
dotNetControl mCheckbox "system.windows.forms.Checkbox" height:22 width:140

on mCheckbox CheckStateChanged senderArg arg do -- event call for checkbox
(
if mCheckbox.checked then
(
mCheckbox.text = "Checked"
)else
(
mCheckbox.text = "UnChecked"
)
)

on sampleRollout open do
(
mCheckbox.Appearance = mCheckbox.Appearance.button -- Set checkbox appearance to button
mCheckbox.text = "UnChecked"
mCheckbox.TextAlign = mCheckbox.TextAlign.MiddleCenter
)
)
createDialog sampleRollout
)

mLichy
04-04-2010, 08:10 AM
Awesome!! I added to it, to make it a flatapperance button, and change colors when down, but that's all I needed :D.

akramparvez
04-04-2010, 10:55 PM
Hi just add this in rollout open event

mCheckbox.FlatStyle = mCheckbox.FlatStyle.Flat -- For flatapperance
mCheckbox.backcolor = mCheckbox.backcolor.lightgreen -- for bgcolor


replace this in checkbox call event


if mCheckbox.checked then
(
mCheckbox.text = "Checked"
mCheckbox.backcolor = mCheckbox.backcolor.red
)else
(
mCheckbox.text = "UnChecked"
mCheckbox.backcolor = mCheckbox.backcolor.lightgreen
)

mikelangelo11
04-04-2010, 11:40 PM
Parvez I am having problem with the treeview, can you help me out.I have a treeview that I set the checkboxes property to true.I don't want to display the checkbox for all the treenodes, just the ones that need them. Is there a setting on the treenode that can hide its checkbox?

akramparvez
04-05-2010, 11:49 PM
You can have checkbox true or false set for the complete treeview. There is no property for individual treenode.

akramparvez
04-06-2010, 01:44 AM
check this
http://forums.cgsociety.org/showthread.php?f=98&t=605129&highlight=treeview. It might help u.

mLichy
04-06-2010, 12:16 PM
Actually the on checked/unchecked stuff I used. I set the mouse over color when the state was changed, and the normal color :)