Recent

Author Topic: [fixed] DragImage adds as new window  (Read 4634 times)

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
[fixed] DragImage adds as new window
« on: May 19, 2012, 01:11:12 pm »
I use custom drag objects with drag images. Normal drag and drop (without self made drag images) works as expected but when I use a drag image it is added to the OS windows list which results in ugly on/off. Both Gtk2 and Qt show this behavior. Is it a bug?

The code is rather simple:

Code: [Select]
function TDragTest.GetDragImages: TDragImageList;
const
  Size=20;
var
  i:integer;
  aBmp:TBitmap;
begin

  FDragImages.Width:=Size; //FDragImages=TDragImageList created with <TDragObject>.Create
  FDragImages.Height:=Size;

  aBmp:=TBitmap.Create;
  try
    aBmp.Width:=Size;
    aBmp.Height:=Size;
    aBmp.Canvas.Brush.Color:=clRed;
    aBmp.Canvas.FillRect(aBmp.Canvas.ClipRect);
    i:=FDragImages.AddMasked(aBmp, clBtnFace);
  finally
    aBmp.Free;
  end;

  Result:=FDragImages;
  Result.SetDragImage(i,Size+1,Size+1);
end;
« Last Edit: May 21, 2012, 05:33:59 pm by Ocye »
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1081
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: DragImage adds as new window
« Reply #1 on: May 20, 2012, 07:13:33 pm »
Drag image list creates new QWidget under qt, so that's why you see it on the list (I guess), but best would be to create an issue and attach example of problem. Then I can look into and probably fix your problem.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: DragImage adds as new window
« Reply #2 on: May 20, 2012, 08:05:24 pm »
I guess it is not related to Qt only. Gtk2 creates a new window as well. It looks like some kind of ShowInTaskBar property. I'd like to attach my test program here and ask for your opinion before posting a bug report.

The code includes my transparency issue. Therefore it looks a little bit strange for only a dragging test.

Qt@Arch Linux 4.81
Lazarus 1.1 r37352 FPC 2.6.0 x86_64-linux-qt
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1081
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: DragImage adds as new window
« Reply #3 on: May 21, 2012, 12:29:41 pm »
Something is wrong with this example (I cannot download it). Please send it to my email. zeljko AT holobitDOTnet  (remove spaces and upper letters with proper signs).

zeljko

  • Hero Member
  • *****
  • Posts: 1081
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: DragImage adds as new window
« Reply #4 on: May 21, 2012, 01:16:03 pm »
I've fixed qt in r37374

zeljko

  • Hero Member
  • *****
  • Posts: 1081
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: DragImage adds as new window
« Reply #5 on: May 21, 2012, 01:33:17 pm »
gtk2 is fixed in r37375 (taskbar entry), but I see problems when moving dragimagelist over your controls ... they're not repainted.

What about transparency ?

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: DragImage adds as new window
« Reply #6 on: May 21, 2012, 05:33:47 pm »
Perfect, no additional "windows" at Gtk2 and Qt.
The test project has no paint event assigned to the main form. Maybe that's the reason why pieces are not redrawn on drag over. In my actual project it runs fine.

Surprisingly, the pieces are drawn well on Darwin. Transparency is still not set in Darwin. But there is an extra thread for that topic.
Lazarus 1.7 (SVN) FPC 3.0.0