RAD Studio VCL Reference
|
Returns the next page in the page control before or after a specified page.
Call FindNextPage to locate a page in the page control by its position relative to the page specified by the CurPage parameter. If the GoForward parameter is true, FindNextPage returns the next page in the page control after CurPage. If GoForward is false, FindNextPage returns the previous page. If CurPage is not a page in the page control, FindNextPage returns the first page when GoForward is true or the last page when GoForward is false. If GoForward is true and CurPage is the last page in the page control, FindNextPage returns the first page. If GoForward is false and CurPage is the first page in the page control, FindNextPage returns the last page.
When CheckTabVisible is true, FindNextPage returns the next page with a TabVisible property set to true, if CheckTabVisible is false, FindNextPage returns the next page, including pages with TabVisible set to false.
C++ Examples:
/* This example requires a new TPageControl, with no new pages created at design time. The form OnCreate event handler adds several new TabSheet controls to the Page Control. The Page Control’s OnChange event handler displays a message dialog when the user changes tabs. The message dialog contains the captions for the tabs immediately before and after the active tab. */ void __fastcall TForm1::FormCreate(TObject *Sender) { for (int i = 0; i < 10; i++) { TTabSheet *pPage = new TTabSheet(PageControl1); // These tabsheets will be cleaned up by their owner (PageControl1). pPage->PageControl = PageControl1; pPage->Caption = AnsiString("Page") + IntToStr(i); pPage->Name = AnsiString("ts") + pPage->Caption; } } void __fastcall TForm1::PageControl1Change(TObject *Sender) { AnsiString PrevCaption, NextCaption; TPageControl *pPC = dynamic_cast<TPageControl *>(Sender); PrevCaption = pPC->FindNextPage(pPC->ActivePage, false, false)->Caption; NextCaption = pPC->FindNextPage(pPC->ActivePage, true, false)->Caption; ShowMessage(AnsiString("Previous tab caption: '") + PrevCaption + AnsiString("' Next tab Caption: '") + NextCaption + AnsiString("'")); }
Delphi Examples:
{ This example requires a new TPageControl, with no new pages created at design time. The form OnCreate event handler adds several new TabSheet controls to the Page Control. The Page Control’s OnChange event handler displays a message dialog when the user changes tabs. The message dialog contains the captions for the tabs immediately before and after the active tab. } procedure TForm1.FormCreate(Sender: TObject); var i: Integer; begin for i := 0 to 9 do with TTabSheet.Create(Self) do begin PageControl := PageControl1; Caption := 'TabSheet #' + IntToStr(i); end; end; procedure TForm1.PageControl1Change(Sender: TObject); var PrevCaption, NextCaption: ShortString; begin with (Sender as TPageControl) do begin PrevCaption := FindNextPage(ActivePage, False, False).Caption; NextCaption := FindNextPage(ActivePage, True, False).Caption; end; ShowMessage('Previous tab caption: "' + PrevCaption + '" Next tab Caption: "' + NextCaption + '"'); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|