Can more than one treeviewnode in a tree be selected at once?

BlitzPlus Forums/BlitzPlus Programming/Can more than one treeviewnode in a tree be selected at once?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This works (and remember you can also Ctrl-select multiple groups).

The only problem is that if you click and drag in the blank area right at the start, without selecting any items, it selects them all! (Maybe you can just pre-select the first item to kick things off.)

And, yes, Snarty -- that had me stumped for a little while... :)

w = 640
h = 480

window = CreateWindow ("Multiple listview item selection", (ClientWidth (Desktop ()) - w) / 2, (ClientHeight (Desktop ()) - h) / 2, w, h, 0)

list = CreateListBox (0, 0, ClientWidth (window), ClientHeight (window) - 25, window) 
SetGadgetLayout list, 1, 1, 1, 1 

For n = 0 To 99
	AddGadgetItem list, "item " + n
Next

button = CreateButton ("Click for result", 0, ClientHeight (window) - 25, ClientWidth (window), 23, window)

hwnd = QueryObject (list, 1)
flags = GetWindowLong (hwnd, -16)
SetWindowLong hwnd, -16, flags + $4

Const LVM_FIRST = $1000
Const LVNI_SELECTED = $2
Const LVM_GETNEXTITEM = LVM_FIRST + 12
Const LVM_SETSELECTIONMARK = LVM_FIRST + 67

Repeat
	
	Select WaitEvent()

		Case $803
			End
			
		Case $401
		
			If EventSource () = button
			
				m$ = "" ; For dialog box string...
				item = -1 ; Start checking from the first item (0)...
				
				Repeat
				
					; Note the 'item' in the parameters -- we search *from* item each time round...
					
					item = SendMessage (hwnd, LVM_GETNEXTITEM, item, LVNI_SELECTED) 
					
					If item <> -1
						m$ = m$ + "Item: " + item + Chr (10)
					EndIf
					
				Until item = -1 ; No more selected items
				
				Notify m$

			EndIf
						
	End Select

Forever