/ Forums / Advansys Formativ / Creating Solutions with Formativ / How do I use the TRzListview?

  • Creator
    Topic
  • #4267
    griesserag
    Participant

      Hello

      How can I add an item to a TRzListview? For each item I also have to add two subitems. How can realise this by code?

      Is it possible to set an option that the user can’t select an item from the listview?

      I ask this questions because I didn’t find anything about that in the form components documentation.

      Thanks.

      Regards

    • Author
      Replies
    • #7666
      lp_irovetz
      Participant

        Hi,

        Here is a extract from one of my code

        ResTabDoc is the Listview whith 4 columns defined
        Result came from a query in a library

        ‘——
        with Dos_Gst.ResTabDoc

        For i = Base to Result.count
        Set DocTrouv = Result.item(i)

        Set oItem = .Items.Add

        oItem.Caption = DocTrouv.document.Creator.DisplayName ‘<— Caption is the first column
        oItem.SubItems.Add(FormatDateTime(DocTrouv.CreationDate,2)

        oItem.SubItems.Add(DocTrouv.subject)
        oItem.SubItems.Add(DocTrouv.document.DocumentNumber)

        next
        end with

        ‘——-

        You could find documention about listview in Raize Component documentation

        You could see
        http://www.advansyscorp.com/forums/topic/3971028821/
        at the top of this forum

        Hope this help

        L.P. Irovetz
        Arcane GroupWare

        #7665
        griesserag
        Participant

          Thanks. This works.

          And how can I disable the select option?

          Regards

          #7668
          Support 1
          Participant

            L.P.:

            Thank you for the sample code.

            griesserag:

            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.

            Regards,
            Advansys Support

            #7667
            griesserag
            Participant

              I want to prevent selection of all items in a listview.

              Regards

            Viewing 4 replies - 1 through 4 (of 4 total)
            • You must be logged in to reply to this topic.