Board index » delphi » Hiding components on a TFrame from the TFrame

Hiding components on a TFrame from the TFrame

Hi,
I have created a frame which I intend to use in many other forms but with
some components of it hidden.

What I tried to do is to add some published properties to the frame object.
Those properties would dynamically hide some components.

like:

type
  TDataFra = class(TFrame)
    PageControl1: TPageControl;
    tabMultiline: TTabSheet;
    tabSingleLine: TTabSheet;
  private
    FAdvancedOnly: boolean;
    procedure SetAdvancedOnly(const Value: boolean);
  public
  published
    property AdvancedOnly : boolean read FAdvancedOnly  write
SetAdvancedOnly;
  end;

implementation

procedure TDataFra.SetAdvancedOnly(const Value: boolean);
begin
  FAdvancedOnly := Value;
  tabMultiline.Visible  := Value;
  tabSingleLine.Visible := not(Value);
end;

In theory it should hide the tab I do not want, but when I set the property
from a form that have this frame on, the TabSheets are not hidden.

Any help would be appreciated.

Thanks in advance,

Daniel Desjardins
http://www.objectiflune.com

 

Re:Hiding components on a TFrame from the TFrame


Quote
In article <3cf69260_1@dnews>, Daniel Desjardins wrote:
> I have created a frame which I intend to use in many other forms but with
> some components of it hidden.

> What I tried to do is to add some published properties to the frame object.
> Those properties would dynamically hide some components.

> procedure TDataFra.SetAdvancedOnly(const Value: boolean);
> begin
>   FAdvancedOnly := Value;
>   tabMultiline.Visible  := Value;
>   tabSingleLine.Visible := not(Value);
> end;

> In theory it should hide the tab I do not want, but when I set the property
> from a form that have this frame on, the TabSheets are not hidden.

You are setting the wrong property. Set TabVisible, not Visible.

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Re:Hiding components on a TFrame from the TFrame


Ok, thanks...even if now I feel like a complete idiot :(
It does exactly what I want, the only thing is I tough I could do it by
"hiding" the TabSheet completely.

Seems I was looking to far.

Thanks again!

Daniel Desjardins
http://www.objectiflune.com

Other Threads