TRzTabbedListbox Oddity

Viewing 2 reply threads
  • Author
    Posts
    • #1793
      Barry Wood
      Participant

        Ray,

        Well, no doubt this is me not being thorough enough! But I’m seeing something in the above that I can’t seem to get rid of. Please see the attached.

        I’m setting the lb up with 2 variable, v & n (v = an event date and n = name of the event). When I add the items (in a loop through a SQL query) the n & v variables contain exactly the information required:

        n:= FieldByName(‘Event’).AsString;
        v:= FieldByName(‘EventDate’).AsString;
        tlbMatches.Items.AddPair( v, n );

        So as you can see in the image a mysterious ‘=’ sign has appeared. I’ve setup a manual tab at 14 (the date part is 10 characters so I’m after a 4 character gap to the event name, yet I get the ‘=’ sign and the event starts at character 12.

        I’m sure I’m doing something wrong but can’t quite see it. Prove me right in being an idiot missing something blindingly obvious to you :-).

      • #1796
        Ray Konopka
        Keymaster

          Hi Barry,

          The Items.AddPair method is actually implemented in the VCL TStrings class and, as its name suggests, is used for adding name=value pairs separated by the ‘=’ sign. The TRzTabbedListBox uses the Tab character #9 as the delimiter, and also supports multiple tab-stops.
          So, to add your items to the list box, you should do the following:

          tlbMatches.Items.Add( v + #9 + n );

          Or, you can use the TRzCustomListBox shortcut of:

          tlbMatches.Add( v + #9 + n );

          Ray

        • #1797
          Barry Wood
          Participant

            Many thanks, as always.

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.