[Closed] Disable modifiers through DatagridView
Hi,
i have a datagridview in the form which lists all the modifiers of an object . The datagridview also has a button column and checkbox column. I am trying to disable/ enable the modifiers using the checkboxes. Anybody having any idea on how to do that.
I tried this code in the click event of button just to check whether it is disabling the modifer.
for obj in selection do obj.modifiers[dgObjModifiers.Rows.Item[e.rowIndex].cells.item[2].value].enabled=false
This works, but it doesn’t update the status of the modifiers in the modifer stack. When i close my form and restart it, i see the modifiers are disabled.
Thanks
Sumesh
Hello,
Thanks to all who read this post. Somehow i was able to solve it almost after a week of trials. Actually it was so easy, it was just a simple logic.
Anybody who plans to use checkboxes in dotNet DatagridView .Here is the way i got around it:
fn dgCellClick e=
(
cellItem=dgObjModifiers.rows.item[e.rowIndex].cells.item[2]
if (e.columnIndex==0) then --Checking the Checkbox state
(
max create mode
if dgObjModifiers.rows.item[e.rowindex].cells.item[0].value==undefined or
dgObjModifiers.rows.item[e.rowindex].cells.item[0].value==false then
(
dgObjModifiers.rows.item[e.rowindex].cells.item[0].value=true
for obj in selection do obj.modifiers[dgObjModifiers.Rows.Item[e.rowIndex].cells.item[2].value].enabled=false
cellItem.Style.Forecolor=(dotNetClass "System.Drawing.Color").DarkGray
)
else if dgObjModifiers.rows.item[e.rowindex].cells.item[0].value==true then
(
dgObjModifiers.rows.item[e.rowindex].cells.item[0].value=false
for obj in selection do obj.modifiers[dgObjModifiers.Rows.Item e.rowIndex].cells.item[2].value].enabled=true
cellItem.Style.Forecolor=(dotNetClass "System.Drawing.Color").Black
)
max modify mode
)
else if (e.columnIndex==1) then
(
for obj in selection do deletemodifier Obj (e.rowIndex+1)
dgObjModifiers.rows.removeAt e.rowIndex
)
else if (e.columnIndex==2) then
(
for obj in selection do modPanel.setCurrentObject obj.modifiers[e.rowindex+1]
)
)
Thanks
Sumesh
Thanks for posting this. I would like to look it over in class when we have time and maybe post it as a tutorial in my dotNet section with credit to your self of course.
I dint know that you made a post to the thread. I just thought you saw it when you were talking about it in class.
Thanks Paul.
Sumesh