-2

I need a property for TPageControl like StartMargin in TTabSet. Does anyone have any idea, how can I create StartMargin property in TPageControl?

For anyone unfamiliar with StartMargin, here is the relevant text from its documentation:

Determines how far, in pixels, the first tab appears from the left edge of the tab set control.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Ali Cetinturk
  • 79
  • 1
  • 10
  • @David, I was unfamiliar with it but as far as I can see TPageControl does not actually contain a TTabset. So what the OP is asking for is tricky at least. So using an actual TTabSet looks the best way to go. – Despatcher Jul 05 '12 at 22:10
  • 1
    possible duplicate of [TPageControl/TTabSheet Position Delphi XE](http://stackoverflow.com/questions/10817698/tpagecontrol-ttabsheet-position-delphi-xe) – David Heffernan Jul 06 '12 at 15:03

2 Answers2

1

if I understand you correctly, then you can do this with the standard controls.

In the object inspector Set TPageControl --> Margins --> Left to say 50. Then set AlignWithmargins to True.

Same applies to TTabSheet

Or do you need something different?

Edit ref your comment: The same also applies to TTabSet: set the left margin, AlignWithMargins and align top on a panel. This gives you your effect. But now you have to manage your own page visibility and page switching :(

Despatcher
  • 1,745
  • 12
  • 18
  • TTabSheet's Left is 50 if I can do this. I do not want TTabSheet position is change or move. You know tab button on top or bottom (if TabPosition is tpTop or tpBottom) (TabSheet1, TabSheet2, etc) just these button start position (or Left position) change from different position. ----------|----------| |TS1 |TS2 | ----------|---------|----------| | | | – Ali Cetinturk Jul 05 '12 at 08:01
0

Or, for a multi-version solution:

uses 
  ..., 
  CommCtrl; 

type 
  TPageControl = class(ComCtrls.TPageControl) 
  private 
    procedure TCMAdjustRect(var Msg: TMessage); message TCM_ADJUSTRECT; 
  end; 

  TForm1 = class(TForm) 
    ... 
  end; 

... 

procedure TPageControl.TCMAdjustRect(var Msg: TMessage); 
begin 
  inherited; 
  if Msg.WParam = 0 then
    Inc(PRect(Msg.LParam)^.Left, 50)
  else
    Dec(PRect(Msg.LParam)^.Left, 50);
end;
NGLN
  • 43,011
  • 8
  • 105
  • 200
  • This is moving TTabSheet. It is not affected to TPageControl button (Tabsheet1, TabSheet2), buttons are still in same position. I need TTabSheets are in same position only buttons are move to different position. – Ali Cetinturk Jul 05 '12 at 08:55
  • Then this question IS a duplicate... from yourself actually. – NGLN Jul 08 '12 at 19:02