Board index » delphi » How can I remove multiple PageControl/Tabsheet borders?

How can I remove multiple PageControl/Tabsheet borders?

My app has a main pagecontrol that is aligned = alClient. On this page control I have multiple Tabsheets. On one of the Tabsheets I have another PageControl with multiple tabsheets, both with aligned=alClient. My problem is at design and runtime, my application shows the borders of all page controls and tabsheets. I've tried setting the Borderwidth property on the Tabsheets to zero but continue to get the same result.
How can I remove them?
Thanks for your,
Jason

 

Re:How can I remove multiple PageControl/Tabsheet borders?


Quote
"jason" <ja...@messagemotion.com.au> wrote:
> [...] My problem is at design and runtime, my application
> shows the borders of all page controls and tabsheets. I've
> tried setting the Borderwidth property on the Tabsheets to
> zero but continue to get the same result.
> How can I remove them?

As far as I know, the only way to do this is to set the
TPageControl.Style property to something other than
tstabs. For example, tsButtons. While this is fine when
you are using a TPageControl as a "poor man's" TFrame (by
setting TTabSheet.Visible to False), it sounds like you
want to see the tabs.

Mark.

Re:How can I remove multiple PageControl/Tabsheet borders?


Mark,
Thanks for your reply. Actually I don't show the Tab's at runtime (I do go through quit a bit of code making tab's invisible during my form's OnCreate event. All in in I've got nested TPageControl's each with multiple TabSheets).
What do you mean "poor man's" TFrame? I've never used a TFrame component before. Are you suggesting that TFrame is better than TPageControl??
Thanks,
Jason.
Quote
"Mark Andrews" <m.andr...@auckland.ac.nz> wrote:

>"jason" <ja...@messagemotion.com.au> wrote:
>> [...] My problem is at design and runtime, my application
>> shows the borders of all page controls and tabsheets. I've
>> tried setting the Borderwidth property on the Tabsheets to
>> zero but continue to get the same result.
>> How can I remove them?

>As far as I know, the only way to do this is to set the
>TPageControl.Style property to something other than
>tstabs. For example, tsButtons. While this is fine when
>you are using a TPageControl as a "poor man's" TFrame (by
>setting TTabSheet.Visible to False), it sounds like you
>want to see the tabs.

>Mark.

Re:How can I remove multiple PageControl/Tabsheet borders?


I didn't found any way to do that.
So i used a TNotebook instead.
I know the advice to use the new Win32 controls, but
since m$ never does anything right, TNotebook solves it perfectly.
I use it manly to step-by-step wizards, there i need to have no borders.

Quote
"jason" <ja...@messagemotion.com.au> wrote in message

news:3e6fe7fe$1@newsgroups.borland.com...
Quote

> My app has a main pagecontrol that is aligned = alClient. On this page

control I have multiple Tabsheets. On one of the Tabsheets I have another
PageControl with multiple tabsheets, both with aligned=alClient. My problem
is at design and runtime, my application shows the borders of all page
controls and tabsheets. I've tried setting the Borderwidth property on the
Tabsheets to zero but continue to get the same result.
Quote
> How can I remove them?
> Thanks for your,
> Jason

Re:How can I remove multiple PageControl/Tabsheet borders?


Yes, that's what one usually does in such a situation:

- Write a unit with a TFrame descendant, eg. TMyFrame.

- Dynamically create the frame when you need it, and set its parent property
to the control on which you want to display the frame, eg a TPanel. For
instance

Procedure frmMain.NewMyframe;
begin
  if assigned(FMyFrame) then FMyFrame.Free;
  FMyFrame := TMyFrame.Create(Self);
  FMyFrame.Parent := Panel1;
  FMyFrame.Align := alClient;
end;

- MyFrame can be a TFrame, so you can have all kinds of descendants,
different frame versions. Just create the correct one at the right moment.

******

There's one component, on the Win3.1 palette, called TNotebook, that does
what you want directly. However, it is depreciated (for whichever reason)
and you shouldn't use it anymore.

Kind regards,

Nils Haeck
www.simdesign.nl

Quote
"jason" <ja...@messagemotion.com.au> wrote in message

news:3e7026b5$1@newsgroups.borland.com...
Quote

> Mark,
> Thanks for your reply. Actually I don't show the Tab's at runtime (I do go

through quit a bit of code making tab's invisible during my form's OnCreate
event. All in in I've got nested TPageControl's each with multiple
TabSheets).
Quote
> What do you mean "poor man's" TFrame? I've never used a TFrame component

before. Are you suggesting that TFrame is better than TPageControl??
Quote
> Thanks,
> Jason.
> "Mark Andrews" <m.andr...@auckland.ac.nz> wrote:

> >"jason" <ja...@messagemotion.com.au> wrote:
> >> [...] My problem is at design and runtime, my application
> >> shows the borders of all page controls and tabsheets. I've
> >> tried setting the Borderwidth property on the Tabsheets to
> >> zero but continue to get the same result.
> >> How can I remove them?

> >As far as I know, the only way to do this is to set the
> >TPageControl.Style property to something other than
> >tstabs. For example, tsButtons. While this is fine when
> >you are using a TPageControl as a "poor man's" TFrame (by
> >setting TTabSheet.Visible to False), it sounds like you
> >want to see the tabs.

> >Mark.

Re:How can I remove multiple PageControl/Tabsheet borders?


is it this your looking for?

unit PageControlEx;

interface

uses
  Windows, Messages, Classes, CommCtrl, ComCtrls, Controls;

type
  TPageControlEx = class(TPageControl)
  private
    FThickFrame: Boolean;
    procedure SetThickFrame(const Value: Boolean);
  protected
    procedure WndProc(var Msg: TMessage); override;
    procedure CreateParams(var Params: TCreateParams); override;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property ThickFrame: Boolean read FThickFrame write SetThickFrame
default true;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Extra', [TPageControlEx]);
end;

constructor TPageControlEx.Create(AOwner: TComponent);
begin
  inherited;
  FThickFrame := True;
  {DoubleBuffered := True;}
  ParentBackground := False;
end;

procedure TPageControlEx.CreateParams(var Params: TCreateParams);
begin
  inherited;
  {BorderWidth := 0;}
  {Params.Style := Params.Style or WS_POPUP;}
  ParentBackground := False;
end;

procedure TPageControlEx.SetThickFrame(const Value: Boolean);
begin
  if FThickFrame <> Value then
  begin
    FThickFrame := Value;
    RecreateWnd;
  end;
end;

procedure TPageControlEx.WndProc(var Msg: TMessage);
begin
  inherited WndProc(Msg);
  if not FThickFrame and (Msg.Msg = TCM_ADJUSTRECT) then
    with PRect(Msg.LParam)^ do
    begin
      Left := 0;
      Right := ClientWidth;
      Top := Top - 8;
      Bottom := ClientHeight;
    end;
end;

end.

"Alexandre Bento Freire" <a-bentofre...@a-bentofreire.com.nospam> schrieb im
Newsbeitrag news:3e705f11@newsgroups.borland.com...

Quote
> I didn't found any way to do that.
> So i used a TNotebook instead.
> I know the advice to use the new Win32 controls, but
> since m$ never does anything right, TNotebook solves it perfectly.
> I use it manly to step-by-step wizards, there i need to have no borders.

> "jason" <ja...@messagemotion.com.au> wrote in message
> news:3e6fe7fe$1@newsgroups.borland.com...

> > My app has a main pagecontrol that is aligned = alClient. On this page
> control I have multiple Tabsheets. On one of the Tabsheets I have another
> PageControl with multiple tabsheets, both with aligned=alClient. My
problem
> is at design and runtime, my application shows the borders of all page
> controls and tabsheets. I've tried setting the Borderwidth property on the
> Tabsheets to zero but continue to get the same result.
> > How can I remove them?
> > Thanks for your,
> > Jason

Re:How can I remove multiple PageControl/Tabsheet borders?


Quote
"jason" <ja...@messagemotion.com.au> wrote:
> What do you mean "poor man's" TFrame? I've never used a
> TFrame component before. Are you suggesting that TFrame is
> better than TPageControl??

There are many situations where it is easier to use a
TPageControl with invisible tabs than a TFrame--for example,
a Wizard or Expert. Another useful application is when you
have a dialog with a large number of tabs. To prevent the
user getting "tab-fatigue" it is sometimes better to place
a TListBox or TTreeView on the left of the dialog and let
its selected members control which TTabSheet is displayed in
the borderless TPageControl occupying the remainder of the
dialog.

This is a purely personal opinion, and there are plenty of
people who love frames instead.

Mark.

Other Threads