Page Control's Close Button

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #36016
    mboloz
    Participant

    Hello there, need help

    i have TsPageControl with properties ShowCloseBtns True, then i make docked form into it, so the number of the page is random just like this…

    n6ie.jpg

    What i want to ask , with a single button i palce outside the PageControl, how i can clicked all active page one by one using looping?

    i just tried this one not even work

    Code:
    for i:=0 to pg.PageCount-1 do
    begin
    pg.CloseClick(pg.ActivePage);
    end;

    Thanks, Regard

    #51479
    Support
    Keymaster

    Maybe this code will work:

    Code:
    for i := pg.PageCount-1 downto 0 do
    begin
    pg.CloseClick(pg.Pages);
    end;

    Can you show a demo?

    Why you clicks on buttons in the loop, but not closing pages directly?

    #51492
    mboloz
    Participant

    That code not work, i just got AV

    emm, i just want to make design like browser+desktop feel, and those single button work like logout, so user no need to close one by one

    here just the example i have made, if something wrong please correct it

    #51494
    Support
    Keymaster

    Thank you

    Try this code:

    Code:
    for i := pg.PageCount-1 downto 0 do
    begin
    DeletePage(TsTabSheet(pg.Pages));
    end;
    #51496
    mboloz
    Participant
    'Support' wrote:

    Thank you

    Try this code:

    Code:
    for i := pg.PageCount-1 downto 0 do
    begin
    DeletePage(TsTabSheet(pg.Pages));
    end;

    Hay Thanks too…

    I Tried those code, but there still 1 form left in the docked.. and what i wanted is to close All the docked From

    Would You Fixed it please

    #51497
    Support
    Keymaster

    This code should close all pages:

    Code:
    for i := pg.PageCount – 1 downto 0 do
    pg.Pages.Free;
    #51498
    mboloz
    Participant
    'Support' wrote:

    This code should close all pages:

    Code:
    for i := pg.PageCount – 1 downto 0 do
    pg.Pages.Free;

    😀 Many Thanks, Work like charm..

    let's me try on my application..

    Best Regard

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.