Recent

Author Topic: ComboBox suggestion (compared to ListView)  (Read 4946 times)

M[a]nny

  • Full Member
  • ***
  • Posts: 130
  • Dreamer
ComboBox suggestion (compared to ListView)
« on: August 09, 2010, 04:19:17 pm »
Hello.

If you've ever used TreeView, you have already seen this code to add item and subitems:
Code: Pascal  [Select][+][-]
  1. var
  2.   li: TListItem;
  3. begin
  4.   li := ListView1.Items.Add;
  5.   li.Caption := 'Title of your item';
  6.   li.SubItems.Add('Some sub-item related to main item');
  7.   li.SubItems.Add('Some other sub-item related to main item');
  8. end;

And you can get these values by this code:
Code: Pascal  [Select][+][-]
  1. ShowMessage(ListView.ItemFocused.Caption); // returns value of the main item
  2. ShowMessage(ListView.ItemFocused.SubItems.Strings[0]); // returns first sub-item value
  3. ShowMessage(ListView.ItemFocused.SubItems.Strings[1]); // returns second sub-item value
  4.  

It is very easy to use so question is ... why to not use this in ComboBox? It would be nice to add more than one item and add related sub-items.
Bad news: Time flies.
Good news: You are the pilot.

Don't try to be perfect, just be unique.

 

TinyPortal © 2005-2018