Recent

Author Topic: CheckGroup selection  (Read 591 times)

slowGoing

  • Newbie
  • Posts: 5
CheckGroup selection
« on: September 20, 2022, 11:20:57 am »
In a CheckGroup is the an option to capture all the selected checkboxes as a number, ie with 4 checkboxes there will be 0 to 15 depending on which ones are checked

BrunoK

  • Hero Member
  • *****
  • Posts: 682
  • Retired programmer
Re: CheckGroup selection
« Reply #1 on: September 20, 2022, 12:37:06 pm »
Code: Pascal  [Select][+][-]
  1. function CheckGroupAsSet(aCheckGroup: TCheckGroup): qword;
  2. var
  3.   i: integer;
  4. begin
  5.   Result := 0;
  6.   for i := aCheckGroup.Items.Count - 1 downto 0 do begin
  7.     Result := Result shl 1;
  8.     if aCheckGroup.Checked[i] then
  9.       Result := Result or 1;
  10.   end;
  11. end;

slowGoing

  • Newbie
  • Posts: 5
Re: CheckGroup selection
« Reply #2 on: September 21, 2022, 11:30:51 am »
Thanks for that, appreciated :D

 

TinyPortal © 2005-2018