View Issue Details

IDProjectCategoryView StatusLast Update
0003282JEDI VCL03 Donationspublic2005-10-21 06:30
ReporterDRothmalerAssigned ToAHUser 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0003282: GetItemAt function for TJvXPBar
DescriptionHi, I wanted to do some Drag&Drop Stuff with the TJvXPBar, but there are no Drag&Drop Events for the TJvXPBarItems, so I had to do it in the Events of TJvXPBar itself.
But the Problem was to find out which Item was draged...
I needed a function, that gives me back the ItemIndex, for a given (Mouse-)Point.
To do this i took some Lines out of the HookMouseMove function, and put them into an new function called GetItemAt.
TagsNo tags attached.

Activities

2005-10-21 03:30

 

JvXPBar.pas.patch (1,779 bytes)
Index: run/JvXPBar.pas
===================================================================
RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvXPBar.pas,v
retrieving revision 1.94
diff -u -r1.94 JvXPBar.pas
--- run/JvXPBar.pas	22 Aug 2005 20:10:10 -0000	1.94
+++ run/JvXPBar.pas	21 Oct 2005 09:51:10 -0000
@@ -492,6 +492,7 @@
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     function GetHitTestAt(X, Y: Integer): TJvXPBarHitTest;
+    function GetItemAt(X, Y: Integer):Integer;
     procedure Click; override;
     property Height default 46;
     property VisibleItems: TJvXPBarVisibleItems read FVisibleItems;
@@ -1765,13 +1766,25 @@
     DoDrawItem(FHoverIndex, []);
 end;
 
+
+function TJvXPCustomWinXPBar.GetItemAt(X, Y: Integer):Integer;
+var
+  Header: Integer;
+begin
+  Header := FC_HEADER_MARGIN div 2 + HeaderHeight + FC_ITEM_MARGIN div 2 + FTopSpace;
+  if (Y < Header) or (Y > Height - FC_ITEM_MARGIN div 2) then
+    Result := -1
+  else
+    Result := (Y - Header) div ItemHeight;
+end;
+
 procedure TJvXPCustomWinXPBar.HookMouseMove(X, Y: Integer);
 const
   cPipe = '|';
 var
   Rect: TRect;
   OldHitTest: TJvXPBarHitTest;
-  NewIndex, Header: Integer;
+  NewIndex : Integer;
 begin
   OldHitTest := FHitTest;
   FHitTest := GetHitTestAt(X, Y);
@@ -1786,11 +1799,8 @@
         Cursor := crDefault;
   end;
 
-  Header := FC_HEADER_MARGIN div 2 + HeaderHeight + FC_ITEM_MARGIN div 2 + FTopSpace;
-  if (Y < Header) or (Y > Height - FC_ITEM_MARGIN div 2) then
-    NewIndex := -1
-  else
-    NewIndex := (Y - Header) div ItemHeight;
+  NewIndex := GetItemAt(X, Y);
+
   if (NewIndex >= 0) and (NewIndex < VisibleItems.Count) then
   begin
     if FStoredHint = cPipe then
JvXPBar.pas.patch (1,779 bytes)

AHUser

2005-10-21 06:30

developer   ~0008049

The patch is now applied to CVS.

Issue History

Date Modified Username Field Change
2005-10-21 03:30 DRothmaler New Issue
2005-10-21 03:30 DRothmaler File Added: JvXPBar.pas.patch
2005-10-21 06:30 AHUser Status new => resolved
2005-10-21 06:30 AHUser Resolution open => fixed
2005-10-21 06:30 AHUser Assigned To => AHUser
2005-10-21 06:30 AHUser Note Added: 0008049