Treeview - highlighting multiple items

£可爱£侵袭症+ 提交于 2019-12-11 04:15:41

问题


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 Selectedrow id doing.

Thanks!


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/6249788/treeview-highlighting-multiple-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!