Forum > Windows

[Solved] Custom component with drag-drop: issue on Windows

(1/1)

AlexTP:
Can somebody please tell me what am I doing wrong?
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39515

This is affecting my main app.

Mr.Madguy:
First of all you need this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TMyPanel.DragOver(Sender, Source: TObject;X,Y: Integer; State: TDragState; var Accept: Boolean);begin  Accept := True;end;   constructor TMyPanel.Create(TheOwner: TComponent);begin  inherited Create(TheOwner);  FMouseDownPnt:= Point(-1, -1);  Cursor:= crIBeam;  OnDragOver := @DragOver;end;   Second - you need to do this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TMyPanel.UpdateCursor;begin  if Mouse.IsDragging then  begin    if ssCtrl in GetKeyShiftState then      DragCursor:= crMultiDrag    else      DragCursor:= crDrag;  end;end;  Please note, that cursor actually changes only after mouse movement. I'm not sure, if it's correct way to do things. Something is still wrong, because cursor flickers. I guess, you mix some "auto" and "manual" drag and drop functionality.

AlexTP:
You are cool!
Thanks for the hint, I just added overloaded DragOver() method.
And 'DragCursor:=...'. Solved!

Navigation

[0] Message Index

Go to full version