Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Neuen Beitrag zur Code-Library hinzufügen (https://www.delphipraxis.net/33-neuen-beitrag-zur-code-library-hinzufuegen/)
-   -   FMX TabControl (https://www.delphipraxis.net/191946-fmx-tabcontrol.html)

KWin 6. Mär 2017 13:29

FMX TabControl
 
Hallo,

ich möchte auf einem TabControl/TabItem einen TButton zu erzeugen.
Die Position des Button (Position.X/Y) soll an der Stelle des Maus-Zeigers erfolgen.
Das ganze spielt sich via Drag and Drop ab.
Egal welches TabItem aktiv ist, es kommen alle OnDragDrop- Events beim TabControl an.
Ich bekomme im TabControl.OnDragDrop- Event die Mausposition innerhalb des TabControl.
Bei der Umrechnung auf die richtige Position des TabItem scheitere ich.

Hier der Code:

Delphi-Quellcode:
procedure TForm3.MyDragDrop(Sender: TObject; const Data: TDragObject; const Point: TPointF);
var
  MyTabCtrl : TTabControl;
  MyTab : TTabItem;
  NewPoint : TPointF;
begin
  if Sender is TControl then begin

    if Sender.InheritsFrom(TTabControl) then begin
      MyTabCtrl := TTabControl(Sender);
      MyTab := MyTabCtrl.ActiveTab;

      // hier möchte ich die aktuelle Maus- Position (Point)
      // auf die Position auf dem TabItem umrechnen
      NewPoint := MyTabCtrl.LocalToAbsolute(Point);  // funtkioniert nicht!
      NewPoint := MyTabCtrl.AbsoluteToLocal(Point);  // funtkioniert nicht!
      NewPoint := MyTab.LocalToAbsolute(Point);      // funktioniert nicht!
      NewPoint := MyTab.AbsoluteToLocal(Point);      // funktioniert nicht!

    end;

  end; // if Sender is TControl
end;
kann mir jemand weiter helfen

Danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:39 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz