🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi
Article #346695

Re: Lepszy TPageControl

#346695
From: Krzysztof Szyszka
Date: Tue, 14 Aug 2018 17:31
45 lines
2177 bytes
> Szukam lepszego komponentu TPageControl, takiego, który można tab przesuwać za pomocą myszy, chcę
> zrobić edytor z Synedit z zakładkami.

Do tego nie potrzeba lepszego komponentu - wystarczy zwykłe drag&drop.

{ PageControl drag&drop events }

procedure TXFDesigner.PageControlMouseDown(Sender: TObject; Button: TMouseButton; Shift:
TShiftState; X, Y: Integer);
begin
  (Sender as TPageControl).BeginDrag(False);
end;

procedure TXFDesigner.PageControlDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
begin
  Accept := (Sender is TPageControl) and (Source = Sender);
end;

procedure TXFDesigner.PageControlDragDrop(Sender, Source: TObject; X, Y: Integer);
const
   TCM_GETITEMRECT = $130A;
var
   Rect: TRect;
   I: Integer;
begin
  with Sender as TPageControl do
  for I := 0 to PageCount-1 do
  begin
    Perform(TCM_GETITEMRECT, I, @Rect);
    if PtInRect(Rect, Point(X, Y)) then
    with ActivePage do
    begin
      if PageIndex <> I then PageIndex := I;
      Exit;
    end;
  end;
end;

-- 
pozdrowienia
Krzysztof Szyszka, X-Files Software
Developer of X-DBGrid Component
Embarcadero Technology Partner
http://www.x-files.pl/
Technical Details
Message-ID: <pkv3lh$oga$1@node1.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <pks07a$hev$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: "Krzysztof Szyszka" <nomail@gazeta.pl>
Newsgroups: pl.comp.lang.delphi
Subject: Re: Lepszy TPageControl
Date: Tue, 14 Aug 2018 19:31:14 +0200
Organization: ATMAN - ATM S.A.
Lines: 46
Message-ID: <pkv3lh$oga$1@node1.news.atman.pl>
References: <pks07a$hev$1@node2.news.atman.pl>
NNTP-Posting-Host: 89-77-104-79.dynamic.chello.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1534267889 25098 89.77.104.79 (14 Aug 2018 17:31:29 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Tue, 14 Aug 2018 17:31:29 +0000 (UTC)
In-Reply-To: <pks07a$hev$1@node2.news.atman.pl>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit