TsPageControl Property OnCloseTab

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #47416
    Support
    Keymaster

      When this event should be called in the component?

      #47419
      pholon
      Participant

        I want to free some memory when TsPageControl closing one tabsheet.

        Can TsPageControl add a method “CloseActivePage”?

        #47427
        pholon
        Participant

          Just like tms.advPageCoutrol : OnCloseActivePage, CloseActivePage Method and so on.

          #47428
          pholon
          Participant

            sPageControl.pas

            procedure TsPageControl.WndProc(var Message: TMessage);

            WM_LBUTTONUP, WM_LBUTTONDOWN:

            if Assigned(OnCloseBtnClick) then OnCloseBtnClick(Self, i, b, Act);

            and

            procedure TsPageControl.CloseClick(Sender: TObject);

            if Assigned(OnCloseBtnClick) then OnCloseBtnClick(Self, TsTabBtn(Sender).Page.TabIndex, ToClose, Act);

            OnCloseBtnClose Renamed OnClosePage, More appropriate.

            if you add a method closePage(iIndex : Integer) to closing the, Just like TsPageControl.CloseClick. it More convenient.

            sorry my bad english.

            thanks

            #47435
            Support
            Keymaster

              Closed page may be destroyed or just hidden,

              How you think, this event should be called in both cases?

              #47445
              pholon
              Participant

                there is a menuitem with caption “CloseAllTabSheets” in mainmenu.

                if this menuitem clicked then calling the method :

                //code

                procedure OnCloseAllTabsheets;

                begin

                while sPageControl1.PageCount 0 do

                begin

                sPageControl1.ActivePageIndex := 0;

                try

                sPageControl1.CloseActivePage; //!!!!!!! need this method or : sPageControl1.ClosePage(aPageIndex : Integer);

                if iPageCount = sPageControl1.PageCount then //close error

                Break;

                except

                on E : Exception do

                begin

                MessageBox(Handle, Pchar(E.Message), 'OK', MB_OK);

                Break;

                end;

                end;

                end;

                end;

                //code

                thanks!

                #47461
                Support
                Keymaster
                  'pholon' wrote:

                  there is a menuitem with caption “CloseAllTabSheets” in mainmenu.

                  if this menuitem clicked then calling the method :

                  //code

                  procedure OnCloseAllTabsheets;

                  begin

                  while sPageControl1.PageCount 0 do

                  begin

                  sPageControl1.ActivePageIndex := 0;

                  try

                  sPageControl1.CloseActivePage; //!!!!!!! need this method or : sPageControl1.ClosePage(aPageIndex : Integer);

                  if iPageCount = sPageControl1.PageCount then //close error

                  Break;

                  …….

                  So, an event is not needed? You want to have a procedure for a pages closing??

                  #47471
                  pholon
                  Participant

                    yes, I want to have a procedure for a pages closing. and when closing, calling OnCloseBtnClose

                    #47520
                    Support
                    Keymaster

                      But why you can't use standard ways for a page closing?

                      I will think about adding the OnClosePage event.

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