* * *

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

Leledumbo

  • Hero Member
  • *****
  • Posts: 2715
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: 1651
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]
var idx:Integer;
begin
  idx:=CheckGroup1.Items.IndexOf('zwei');
  if idx>-1 then CheckGroup1.Checked[idx]:=true;
end; 

Leledumbo

  • Hero Member
  • *****
  • Posts: 2715
Re: Referring to TCheckGroup items by caption
« Reply #2 on: September 07, 2010, 07:24:11 am »
Doh!, I didn't realize that. Thanks
  • .

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads