Treeview - highlighting multiple items
In Powerbuilder, Does anyone here know how am i going to highlights multiple items on a treeview? Selecteditem function is not doing that. Im looking for a behavior just what Sele开发者_开发问答ctedrow id doing.
Thanks!
I've not tried this myself but there is an example on CodeXchange (look for Multi-select TreeView Control).
I think the treeview style datawindow might be easier to do this with.
If not, I found this on the newsgroup, don't know if it helps:
The following script in the selectionchanged event will implement a very basic multiselect in the treeview:
treeviewitem ltvi_item if KeyDown(KeyControl!) then This.GetItem(oldhandle, ltvi_Item) ltvi_Item.Selected = True This.SetItem(oldhandle, ltvi_Item) end if
A problem is deselecting the previously selected items. You would have to scan through ALL items do look for the selected ones (once the user clicks an item without holding down the control key)
https://groups.google.com/forum/#!msg/powersoft.public.powerbuilder.objects/B2ulHBrSnrs/itwhNBjlyOoJ
One approach to this is to use the CheckBoxes attribute on the treeview, then check the treeviewitem's StatePicture (Unchecked = 1, Checked = 2).
Good luck,
Terry.
精彩评论