View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003197 | JEDI VCL | 00 JVCL Components | public | 2005-09-15 05:55 | 2006-01-08 11:57 |
Reporter | mhoeper | Assigned To | obones | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | 3.20 | |||
Summary | 0003197: Parameter "Rect" in the "OnDrawLeftMargin" event in class "TJvStandardMenuItemPainter" is wrong. | ||||
Description | There is a bug in the TJvCustomMenuItemPainter.Paint method, if "menu animation" in Windows is ENABLED: CanvasWindow := WindowFromDC(Canvas.Handle); // CanvasWindow = 0! GetWindowRect(CanvasWindow, CanvasRect); // CanvasRect wrong LeftMarginRect := Rect(..., 0, ..., CanvasRect.Bottom - ...) // LeftMarginRect wrong so that the calculated LeftMarginRect in this method is wrong. Afterwards the event OnDrawLeftMargin in TJvStandardMenuItemPainter gets a wrong Rect parameter. | ||||
Additional Information | Only occures if "menu animation" in Windows system ("system control/display/design?(the tab next to settings)/effects") is turned on. A solution could be changing the "TrackPopupMenu" WindowsAPI call in method "TJvPopupMenu.Popup" in the following way: TrackPopupMenu(Items.Handle, Flags[UseRightToLeftAlignment, Alignment] or Buttons[TrackButton] or TPM_NOANIMATION, X, Y, 0, PopupList.Window, nil); | ||||
Tags | No tags attached. | ||||
|
WindowFromDC does not always return 0. When drawing a menu, there is at least one time when it returns a valid handle. As such, the rectangle will be ok that time. What about I do not call DrawLeftMargin if WindowFromDC returned 0? That would change the code from this: // draw the margin, if any if LeftMargin > 0 then DrawLeftMargin(LeftMarginRect); to this: // draw the margin, if any if (LeftMargin > 0) and (CanvasWindow <> 0) then DrawLeftMargin(LeftMarginRect); This is ok with me, but what about you? |
|
That works wrong, too: In this case DrawLeftMargin will not be called, if the Menu pops up, because the CanvasWindow is 0 this time. Its only <> 0, if you move the mouse over an menu item. So my Graphic will only drawed in the Rect of the single menu item: procedure TMy.JvStandardMenuItemPainterDrawLeftMargin( Sender: TMenu; Rect: TRect); begin JvPopupMenu.Canvas.Draw(Rect.Left, Rect.Top, MyImage.Picture.Graphic); end; |
|
I've put some changes inside JvMenus that address this issue. See around line 2183 for the explanation. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-09-15 05:55 | mhoeper | New Issue | |
2005-11-26 05:28 | obones | Status | new => assigned |
2005-11-26 05:28 | obones | Assigned To | => obones |
2005-11-26 09:10 | obones | Note Added: 0008168 | |
2005-11-26 09:10 | obones | Status | assigned => feedback |
2005-11-30 01:33 | mhoeper | Note Added: 0008177 | |
2006-01-08 11:57 | obones | Status | feedback => resolved |
2006-01-08 11:57 | obones | Resolution | open => fixed |
2006-01-08 11:57 | obones | Note Added: 0008341 |