On 11/10/2013 22:00, Mark Morgan Lloyd wrote:

Given a TPageControl with several existing pages, how does one insert
a page at a specified position rather than at the end?

This function should do it:

uses ComCtrls;

function InsertAt(ExistingIndex: integer;
                  aPageControl: TPageControl): TTabSheet;
begin
  Result:=nil;
  if (ExistingIndex<0) or (ExistingIndex>aPageControl.PageCount-1) then
    Exit;
  Result:= aPageControl.AddTabSheet;
  if aPageControl.IndexOf(Result) <> ExistingIndex then
    TNBPages(TCustomTabControl(aPageControl).Pages).Move(
                aPageControl.IndexOf(Result), ExistingIndex);
end;



--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to