How to create a group off objects and enable - disable all the group

I want to have in some off my reports the ability to enable a group of columns with a case contition (like a checkbox at dialog page) at once .

I there a way to do this without to have I to enable - diasble all objects one by one ?

I need something like ->

if checkbox1.checked then

< group of objects>.Visible:=thue

Comments

  • LurkingKiwiLurkingKiwi Wellington, New Zealand

    This isn't quite what you are asking for, but you can get the same effect. Basically, you use the Name or Tag or TagStr field as a classifier, and iterate all the objects checking the tag against some report data field. I do this in my DetailData OnBeforePrint where it walks the objects on that band, tweaking the visibility, font size etc. I print labels, and have similar code which hides or reveals a label outline.


    procedure SitterOnBeforePrint(Sender: TfrxComponent);

    var

     s, thiscol : string;

     i, len : integer;

     c : TObject;

     thememo : TfrxMemoView;



    begin

    thiscol := <fd>; //data field

    for i := 0 to Sender.Objects.Count - 1 do begin

     c := Sender.Objects[i]; 

     if c is TfrxMemoView then begin

       thememo := TfrxMemoView(c);                                 

       s := thememo.Name; // I am actually using the name here, but could use the tag

       len := length(s);                                     

       if (copy(s, 1, 5) = 'From_') or (copy(s, 1, 3) = 'To_') then begin                                                                                      

         thememo.Visible := ((s[1] = 'F') and (s[len] = thiscol[1])) or ((s[1] = 'T') and (s[len - 1] = thiscol[1])); 

         end

    <<Rest of code snipped here>>

Leave a Comment