View Issue Details

IDProjectCategoryView StatusLast Update
0024022LazarusLCLpublic2017-01-23 16:31
ReporterMaciej IzakAssigned ToMichl 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindows 7OSOS Version
Product Version1.1 (SVN)Product Build 
Target VersionFixed in Version1.7 (SVN) 
Summary0024022: TTabControl (Drag and Drop) don't work
DescriptionThis code don't work in Lazarus (in Delphi it is ok):

// Source http://www.delphipraxis.net/590633-post.html#684420

procedure TDemoForm.TabControlDragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
  with Sender as TTabControl do
    Accept := (IndexOfTabAt(X, Y) <> TabIndex);
end;

procedure TDemoForm.TabControlDragDrop(Sender, Source: TObject; X,
  Y: Integer);
var
  index: Integer;
begin
  if Sender = Source then
    with Sender as TTAbControl do
    begin
      index := IndexOfTabAt(X, Y);
      Tabs.Exchange(TabIndex, index);
      TabIndex := index;
    end;
end;

procedure TDemoForm.TabControlMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  p: TPoint;
begin
  with Sender as TTabControl, p do
  begin
    p := ScreenToClient(Mouse.CursorPos);
    if IndexOfTabAt(X, Y) > -1 then
      BeginDrag(False);
  end;
end;
TagsNo tags attached.
Fixed in Revisionr53981
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0027467 resolvedMichl TTabControl.IndexOfTabAt() always returns -1 

Activities

Zeljan Rikalo

2015-02-14 22:31

developer   ~0081076

Please attach complete example project.

Michl

2017-01-22 23:14

developer  

TestTabControl.zip (2,206 bytes)

Michl

2017-01-22 23:22

developer   ~0097636

Fixed in trunk. Please test and close if ok.

Alexey Tor.

2017-01-23 00:44

reporter   ~0097637

+ if Assigned(TTabControl(Parent).OnStartDrag) then
+ TTabControl(Parent).OnStartDrag(Parent, DragObject);
+ if not Assigned(DragObject) then
+ DragObject := TDragControlObject.AutoCreate(Parent);
U first use DragObject, then check if itis not nil: maybe swap lines

Michl

2017-01-23 08:01

developer   ~0097640

No, it is Delphi compatible and compatible to other LCL controls. See inherited method.

Alexey Tor.

2017-01-23 16:31

reporter   ~0097644

Michl- you can easy this 0021723; I made a fix in last comment..

Issue History

Date Modified Username Field Change
2013-03-10 00:02 Maciej Izak New Issue
2015-02-14 14:23 Juha Manninen Relationship added related to 0027467
2015-02-14 22:31 Zeljan Rikalo LazTarget => -
2015-02-14 22:31 Zeljan Rikalo Note Added: 0081076
2015-02-14 22:31 Zeljan Rikalo Status new => feedback
2017-01-22 23:13 Michl Assigned To => Michl
2017-01-22 23:13 Michl Status feedback => assigned
2017-01-22 23:14 Michl File Added: TestTabControl.zip
2017-01-22 23:22 Michl Fixed in Revision => r53981
2017-01-22 23:22 Michl Note Added: 0097636
2017-01-22 23:22 Michl Status assigned => resolved
2017-01-22 23:22 Michl Fixed in Version => 1.7 (SVN)
2017-01-22 23:22 Michl Resolution open => fixed
2017-01-23 00:44 Alexey Tor. Note Added: 0097637
2017-01-23 08:01 Michl Note Added: 0097640
2017-01-23 16:31 Alexey Tor. Note Added: 0097644