Please help me


#1

hello my friends
I have a problem with my script. I have a list of Item in dot net listview. I need to count the checked items. I use the itemCheck event that every time I check or uncheck an item it recalls a function for count the checked item(s). but it doesn’t work correctly. it always shows me one step before. I mean if we have 7 items that all of them are checked, it shows us 7 items are checked (that it is Ok). now if we uncheck one of these items, it still shows us 7 items are checked! if we unchecked another one of the items, it shows us 6 items checked. I use the PRINT command to see what happens. A print command for No of every item and another for the state of every item’s checkbox (true/false). Any time I check or unchecked one of them, it writes the previous state of that item and if I repeat that for another, it writes the state of the first item that I checked/unchecked it and etc.
please help me if you can.


#2
try (destroydialog X ) catch ()
rollout X "" height:250 (

	label txt "checked: 0"
	
	dotnetcontrol lv "System.Windows.Forms.ListView"
	
	on x open do 
	(

		lv.View = (dotNetClass "System.Windows.Forms.View").Details
		lv.Columns.add "items" 50
		lv.Columns.add "squares" 100
		lv.CheckBoxes = true
		lv.gridLines = true
		
		for i=1 to 9 do 
		(
			li = dotNetObject "System.Windows.Forms.ListViewItem"  (i as string)
			li.SubItems.add ((i*i) as string)
			
			lv.Items.Add li
		)
		
		lv.height = 200

	)
	
	on lv ItemChecked sender arg do
	(
		txt.text = "checked: " + sender.CheckedIndices.count as string		
	)
)
createDialog X

#3

thanx alot serejah
I can solve my mistake with your guide. your script very helpful.
good luck