RxFPC:fix mouse drag listbox items in dual list dialog

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7557 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2020-07-23 06:22:09 +00:00
parent 64b69c2893
commit 481e50d840
2 changed files with 40 additions and 49 deletions

View File

@ -35,7 +35,7 @@ unit rxboxprocs;
interface interface
uses Classes, Controls, StdCtrls; uses Classes, Controls, StdCtrls, LCLType;
const const
LB_ERR = -1; LB_ERR = -1;
@ -293,26 +293,17 @@ var
R: TRect; R: TRect;
procedure DrawItemFocusRect(Idx: Integer); procedure DrawItemFocusRect(Idx: Integer);
(* var
{$IFDEF WIN32} P: TPoint;
var DC: HDC;
P: TPoint;
DC: HDC;
{$ENDIF}
begin
R := BoxItemRect(List, Idx);
{$IFDEF WIN32}
P := List.ClientToScreen(R.TopLeft);
R := Bounds(P.X, P.Y, R.Right - R.Left, R.Bottom - R.Top);
DC := GetDC(0);
DrawFocusRect(DC, R);
ReleaseDC(0, DC);
{$ELSE}
BoxGetCanvas(List).DrawFocusRect(R);
{$ENDIF}
*)
begin begin
BoxGetCanvas(List).DrawFocusRect(R); R := BoxItemRect(List, Idx);
P := List.ClientToScreen(R.TopLeft);
R := Bounds(P.X, P.Y, R.Right - R.Left, R.Bottom - R.Top);
DC := GetDC(0);
DrawFocusRect(DC, R);
ReleaseDC(0, DC);
end; end;
begin begin

View File

@ -1,7 +1,7 @@
object DualListForm: TDualListForm object DualListForm: TDualListForm
Left = 916 Left = 1073
Height = 344 Height = 344
Top = 266 Top = 33
Width = 552 Width = 552
ActiveControl = IncBtn ActiveControl = IncBtn
BorderIcons = [] BorderIcons = []
@ -11,14 +11,14 @@ object DualListForm: TDualListForm
OnActivate = ListClick OnActivate = ListClick
OnShow = ListClick OnShow = ListClick
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.5' LCLVersion = '2.1.0.0'
object SrcLabel: TLabel object SrcLabel: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 6 Left = 6
Height = 21 Height = 17
Top = 6 Top = 6
Width = 45 Width = 40
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Source' Caption = 'Source'
@ -27,10 +27,10 @@ object DualListForm: TDualListForm
object DstLabel: TLabel object DstLabel: TLabel
AnchorSideLeft.Control = DstList AnchorSideLeft.Control = DstList
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 299 Left = 302
Height = 21 Height = 17
Top = 6 Top = 6
Width = 31 Width = 27
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Dest' Caption = 'Dest'
ParentColor = False ParentColor = False
@ -43,8 +43,8 @@ object DualListForm: TDualListForm
AnchorSideBottom.Control = ButtonPanel1 AnchorSideBottom.Control = ButtonPanel1
Left = 6 Left = 6
Height = 257 Height = 257
Top = 33 Top = 29
Width = 247 Width = 244
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
DragMode = dmAutomatic DragMode = dmAutomatic
@ -56,7 +56,7 @@ object DualListForm: TDualListForm
OnDragOver = SrcListDragOver OnDragOver = SrcListDragOver
OnKeyDown = SrcListKeyDown OnKeyDown = SrcListKeyDown
ParentShowHint = False ParentShowHint = False
ScrollWidth = 245 ScrollWidth = 242
ShowHint = True ShowHint = True
Sorted = True Sorted = True
TabOrder = 0 TabOrder = 0
@ -70,10 +70,10 @@ object DualListForm: TDualListForm
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel1 AnchorSideBottom.Control = ButtonPanel1
Left = 299 Left = 302
Height = 257 Height = 257
Top = 33 Top = 29
Width = 247 Width = 244
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
DragMode = dmAutomatic DragMode = dmAutomatic
@ -85,7 +85,7 @@ object DualListForm: TDualListForm
OnDragOver = DstListDragOver OnDragOver = DstListDragOver
OnKeyDown = DstListKeyDown OnKeyDown = DstListKeyDown
ParentShowHint = False ParentShowHint = False
ScrollWidth = 245 ScrollWidth = 242
ShowHint = True ShowHint = True
Sorted = True Sorted = True
TabOrder = 5 TabOrder = 5
@ -96,10 +96,10 @@ object DualListForm: TDualListForm
AnchorSideTop.Control = SrcList AnchorSideTop.Control = SrcList
AnchorSideRight.Control = IncAllBtn AnchorSideRight.Control = IncAllBtn
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 259 Left = 256
Height = 41 Height = 41
Top = 39 Top = 35
Width = 34 Width = 40
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -116,10 +116,10 @@ object DualListForm: TDualListForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IncBtn AnchorSideTop.Control = IncBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 259 Left = 256
Height = 41 Height = 41
Top = 86 Top = 82
Width = 34 Width = 40
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
@ -136,10 +136,10 @@ object DualListForm: TDualListForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IncAllBtn AnchorSideRight.Control = IncAllBtn
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 259 Left = 256
Height = 41 Height = 41
Top = 133 Top = 129
Width = 34 Width = 40
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -157,10 +157,10 @@ object DualListForm: TDualListForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IncAllBtn AnchorSideRight.Control = IncAllBtn
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 259 Left = 256
Height = 41 Height = 41
Top = 180 Top = 176
Width = 34 Width = 40
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -174,8 +174,8 @@ object DualListForm: TDualListForm
end end
object ButtonPanel1: TButtonPanel object ButtonPanel1: TButtonPanel
Left = 6 Left = 6
Height = 42 Height = 46
Top = 296 Top = 292
Width = 540 Width = 540
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True