[DUG] TPageControl InterestingObservation D2007
John Bird
johnkbird at paradise.net.nz
Wed Aug 29 09:31:55 NZST 2007
I use standard page controls in D2007, and do hiding etc of the tabs, and
haven't any issues....
What I am trying to achieve is a form that changes its appearance according
to what is going on, ie as it changes from one mode to another on part of
the form controls appear and disappear. In this case I am using it with the
page control invisible....no border or buttons show. It all works just fine
with the standard page control.
I just use code that specifically controls what I want....eg
////////////////////////////////////////////////////////////////
// hides all tabs (not the tabsheet itself) in the pagecontrol,
// and selects the first tabsheet as the active displayed.
procedure TForm1.HideTabsInPageCtrl;
var
iPage: Integer;
begin
// hide the tabs
for iPage := 0 to PageControl1.PageCount - 1 do
PageControl1.Pages[iPage].TabVisible := False;
// set the active tabsheet
if (PageControl1.PageCount > 0) then
PageControl1.ActivePage := PageControl1.Pages[0];
// hide the border of the pagecontrol
PageControl1.Style := tsButtons;
end;
I also have buttons to change which page control is active....eg
procedure TForm1.btntabRunClick(Sender: TObject);
begin
pagecontrol1.activepageindex:=0;
end;
And other code to set the tab control programmatically...eg
//set tab back to where mode is
if frmLookup.visible=true then exit; //don't mess up lookup
if RunMode = 'Run' then pagecontrol1.activepageindex:=0;
if RunMode = 'Finish' then pagecontrol1.activepageindex:=1;
if RunMode = 'Start' then pagecontrol1.activepageindex:=2;
if RunMode = 'Disb' then pagecontrol1.activepageindex:=3;
And so on....
John
More information about the Delphi
mailing list