dotNet listview and checkboxes
This is a snippet of code where I want to control the checkboxes by multiple selections in the listview itself and hitting the checkbox (whether it is checked or not) to select / de-select them accordingly, trouble is when I do this it doesn't do them in one but for each item.
Basically, if I shift and select the items and check off the box the value counts down in real-time for the countLabelVal text.
Is there a dotNet way of doing this?
on lv ItemChecked do part of the code below is the trouble maker.
-- This is a snippet of code where I want to control the checkboxes by multiple selections and hitting the checkbox (whether checked or not) to select / de-select them accordingly, trouble is when I do this it doesn't do them in one but for each item. Is there a dotNet way of doing this? try(destroydialog ::lvRolTest)catch() rollout lvRolTest "Check Mate.." ( local lvSetItemsProp local reSizeListView label countLabelPrefix "How many you say ?" across:3 label countLabelVal "" checkButton ChkLvButton "Un/check All..." dotNetControl lv "ListView" width:250 height:545 pos:[10,30] on lvRolTest open do ( lv.View = (dotNetClass "View").Details lv.FullRowSelect = true lv.GridLines = true lv.MultiSelect = true lv.Checkboxes = true lv.Columns.add ("Items") reSizeListView() for x=1 to 100 do ( lv.BeginUpdate() local newLvItem = dotNetObject "ListViewItem" ("Item " + x as string) newLvItem.checked = true lv.EndUpdate() lv.items.add newLvItem ) lv.Focus() countLabelVal.text = (lv.CheckedItems.count) as string ) on lvRolTest resized val do ( reSizeListView() ) on ChkLvButton changed state do ( if state do ChkLvButton.text = "Check All..." lvSetItemsProp rolArg:(#lvRolTest as string) lsArg:(#lv as string) prop:#Checked state:((not state) as string) if not state do ChkLvButton.text = "Uncheck All..." countLabelVal.text = (lv.CheckedItems.count) as string lv.Focus() ) on lv ItemChecked do ( if lv.CanSelect and lv.CanFocus and lv.Focused then ( lv.BeginUpdate() countLabelVal.text = (lv.CheckedItems.count) as string lv.EndUpdate() ) ) fn reSizeListView = ( lv.width = lvRolTest.width-20 lv.height = lvRolTest.height-40 lv.columns.item[0].width = lvRolTest.width-40.5 ) fn lvSetItemsProp rolArg:#rolArg lsArg:#lsArg prop:#checked state:#false = ( execute("for i = 0 to "+rolArg+"."+lsArg+".items.count-1 do "+rolArg+"."+lsArg+".items.item[i]."+prop+"="+state) ) ) createDialog lvRolTest 270 575 style:#(#style_SysMenu, #style_ToolWindow, #style_resizing) -- lvRolTest.ChkLvButton.state = true