Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#3

Re: On Button click close all TPageControl TTabSheet`s

  Alt 7. Jan 2006, 09:15
Try this:

Delphi-Quellcode:
procedure TWebForm.CloseAllButtonClick(Sender: TObject);
begin
  with PageControl do
    while PageCount > 0 do
      ActivePage.Free;
end;

procedure TWebForm.PageControlContextPopup(Sender: TObject;
  MousePos: TPoint; var Handled: Boolean);
var
  i: integer;
begin
  i := PageControl.IndexOfTabAt(MousePos.X, MousePos.Y);
  if i <> -1 then
  begin
    PageControl.ActivePageIndex := i;
    Handled := true;
  end;
end;
Notice that you can't have a context menu associated with the tab sheet header anymore.

marabu
  Mit Zitat antworten Zitat