Recent

Author Topic: Referring to TCheckGroup items by caption  (Read 6620 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Referring to TCheckGroup items by caption
« on: September 06, 2010, 10:36:05 am »
Sometimes it's not convenient to look for checked items through TCheckGroup.Checked[<Integer>], since the index will change when the order is changed. Is there any other property to access it by caption ? e.g. TCheckGroup.Checked['An item']

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Referring to TCheckGroup items by caption
« Reply #1 on: September 06, 2010, 11:25:09 am »
TCheckGroup's Items are TStrings, so you can use IndexOf.

Code: Pascal  [Select][+][-]
  1. var idx:Integer;
  2. begin
  3.   idx:=CheckGroup1.Items.IndexOf('zwei');
  4.   if idx>-1 then CheckGroup1.Checked[idx]:=true;
  5. end;  

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Referring to TCheckGroup items by caption
« Reply #2 on: September 07, 2010, 07:24:11 am »
Doh!, I didn't realize that. Thanks
  • .

 

TinyPortal © 2005-2018