Support 1


Thank you for the sample code.


Neither the listview nor the listitem provides a property to disable selection. Do you want to prevent selection of all items or specific items?

You may be able to do this with a handler for the OnChanging event. While editing the form, select the listview. Go to the Object Inspector and select the Events tab. Double-click on the item OnChanging. This will generate a new, empty, Sub in the applet source code. The sample code below was edited to prevent selection of the item whose first column text is “Informatik”.

Sub MainFormRzListView1Changing(Sender, Item, Change, ByRef AllowChange)

  if Change = ctState then
    AllowChange = (Item.Caption <> "Informatik")
  end if

End Sub

NB: In the sample above, I inserted the keyword ByRef before parameter AllowChange. This was necessary because the Forms Designer fails to do so. The documentation for this event shows that AllowChange is a var (ie. reference) parameter.

In practice this may not be a perfect solution. Another approach is to put the items that you do not want ‘selected’ into another control. For example, use a second listview in which it is not important whether an item is selected or not.

See the documentation suggested by L.P. for more details on TRzListView.

I hope this helps.

Advansys Support