View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003282 | JEDI VCL | 03 Donations | public | 2005-10-21 03:30 | 2005-10-21 06:30 |
Reporter | DRothmaler | Assigned To | AHUser | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | 3.10 | |||
Summary | 0003282: GetItemAt function for TJvXPBar | ||||
Description | Hi, 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. | ||||
Tags | No tags attached. | ||||
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 |
|
The patch is now applied to CVS. |
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 |