Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001862 [JEDI VCL] 00 JVCL Components minor always 2004-06-15 08:21 2006-06-08 07:43
Reporter AlexeiR View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0001862: JvMainMenu: strange drawing in XP Style
Description I've attached 3 screen copies of my main menu.
The first appears when I first click on menu item, and a submenu is dropping down.
The second appears when moving mouse cursor down over a submenu.
The third appears when I moving mouse to another submenu and then return back.
From this moment all is ok if I'm not leaving main menu.
If I close it and click some item again... see menubug1.gif.
Additional Information
Tags No tags attached.
Attached Files gif file icon MenuBug1.gif [^] (9,349 bytes) 2004-06-15 08:22
gif file icon MenuBug2.gif [^] (9,497 bytes) 2004-06-15 08:22
gif file icon MenuBug3.gif [^] (9,123 bytes) 2004-06-15 08:22
jpg file icon Menu1.jpg [^] (24,736 bytes) 2004-07-06 01:31
jpg file icon Menu2.jpg [^] (23,998 bytes) 2004-07-06 01:31
png file icon viso_xp_menu_example.png [^] (3,966 bytes) 2005-05-20 21:35
jpg file icon Screenshot merged menus.jpg [^] (10,886 bytes) 2006-04-09 09:38

- Relationships
related to 0003124closed TJvXPMenuItemPainter Paint Error 

-  Notes
(0004682)
obones (administrator)
2004-07-05 00:18

Note to me: It seems the drawing of the border is not done when not selecting an item. Will investigate.
(0004696)
obones (administrator)
2004-07-05 23:21

I cannot reproduce this. Does this happen at Runtime ?
(0004697)
AlexeiR (reporter)
2004-07-06 00:57

Yes, it happens at runtime.
I'm using Win2000. It seems to be no bug under XP.
Well I'll check this with a new snapshot of JVCL and report results.
(0004698)
xerkan (reporter)
2004-07-06 01:32

I also have a similar error with submenus using the JvMainMenu component with the XP Style.

Show images Menu1.jpg and Menu2.jpg
(0004780)
AlexeiR (reporter)
2004-07-20 11:07

I've checked new version of jvMenus...
This bug continues to appear in Win2K, but again all OK under WinXP.
Menu has a flat look under XP (always)
and under Win2K (after cursor moving - MenuBug2.gif, MenuBug3.gif).
But after first dropdown it has 3D look (MenuBug1.gif).
(0004945)
obones (administrator)
2004-08-05 23:17

I don't have Windows 2000 installed here and as a result cannot test to try to find a bug fix. However, you (or others) can help me figure out what is going wrong.
Here are my instructions:

Use a TJvMainMenu with XP style and a few items. Run the program.
Click on one of the top menu items to open the menu and DO NOT move the mouse any further. The bug is that the border of the menu is not painted flat and still has its 3D look.
Look on the top left corner of the screen in case the drawing appears there (this is the most likely place, but look on the entire screen). If it does, let me know, I'll have to think as to why. If not, then look in TJvXPMenuItemPainter.Paint and comment out the code that tests for the Owner not being the CanvasWindow (from 3085 to 3088). Try again and let me know the outcome.

The painting code for the border is in the Paint method of TJvXPMenuItemPainter, there shouldn't be any need to look anywhere else.

Thanks for your help.
(0004948)
user72
2004-08-06 02:24

Just a thought: does this bug appear in XP when running with the classic look? In that case, it should be easy enough testing it even on XP.
(0004949)
obones (administrator)
2004-08-06 02:31

No, it doesn't, I turned off all theme support under XP.
(0005097)
anonymous (viewer)
2004-08-26 03:23

The bug only appears in Win2K when option "Display Properties" - "Effects" - "Use transition effect for menus and tooltips" is turned ON !
TO obones: your instructions I haven't tried yet, but can do it soon.
AlexeiR.
(0005395)
obones (administrator)
2004-10-15 00:30

Ok, thanks for the tip about the effects on the menus. I'll try to turn them on in WinXP and see how it goes.
(0005428)
anonymous (viewer)
2004-10-18 06:22

It's strange again but the bug seems doesn't appears under XP even when effects is turned on...
(0005693)
anonymous (viewer)
2004-11-23 09:48

The menu shows the same error... but there is Windows XP SP1. So the bug appears on Windows XP as well.
(0007284)
FlyingAvatar (reporter)
2005-05-20 21:32

I've had similiar problems with the XP style in the past. It had come to mind just now and I realized the difference between JVCL's XP menu drawing and others that I have seen:

Office XP's (and Delphi 7's IDE) sub-menus do not overlap their parent menu.

They do share a 1 pixel common border. If the sub-menus were placed as such, then the Menu2.jpg problem would not occur.
(0007289)
obones (administrator)
2005-05-21 06:40

That is right, however, I do not know how to tell the operating system the position where I want the submenu to appear (yet). If anyone has any idea as to how to do this, I'd be glad to hear about it.
(0007381)
anonymous (viewer)
2005-06-02 04:24

I get the same bug (MenuBug1-3) on an XP system with theming enabled when using XP menu style.
(0007383)
anonymous (viewer)
2005-06-02 05:38

Possible Workaround - Please test

In procedure TJvXPMenuItemPainter.Paint

Change 1:
        // three lines before right <- Find comment and change the lines below
// if IsRightToLeft then
// Pen.Color := ImageBackgroundColor
// else
// Pen.Color := clWhite;
        Pen.Color := clWhite; // KV

Change 2:
        // two lines after left <- Find comment and change the lines below
// if IsRightToLeft then
// Pen.Color := clWhite
// else
// Pen.Color := ImageBackgroundColor;
        Pen.Color := clWhite; // KV

Change 3: In TJvXPMenuItemPainter.Paint often CanvasWindow and WRect are invalid

//KV GetWindowRect(CanvasWindow, WRect); <- replace with code below
      if not GetWindowRect(CanvasWindow, WRect) then begin
        inherited Paint(Item, ItemRect, State);
        Exit;
      end;
(0007385)
anonymous (viewer)
2005-06-02 06:10
edited on: 2005-06-02 06:14

A few more changes (4 replaced lines - see below marked KV). With these and the changes in the previous note XP menus work well for me.

Still in procedure TJvXPMenuItemPainter.Paint

        // and one more line on one side, depending on the bidi mode
        // the line will only be drawn if the drawing rectangle is smaller
        // than the borders
        // also add a line of image background at the top and bottom
        // of the column to look even more like the real XP menus.
        Pen.Style := psSolid;
        Pen.Color := ImageBackgroundColor;
        if not IsRightToLeft then
        begin
          if ItemRect.Left > 0 then
          begin
            MoveTo(WRect.Left + 3, WRect.Top + ItemRect.Top + 3);
            LineTo(WRect.Left + 3, WRect.Top + ItemRect.Bottom + 3);
            //MoveTo(WRect.Left + 1, WRect.Top + 2);//replaced
            MoveTo(WRect.Left + 3, WRect.Top + 2);//KV
            LineTo(WRect.Left + 1 + CheckMarkWidth + ImageMargin.Left + ImageWidth + ImageMargin.Right + 1, WRect.Top + 2);
            //MoveTo(WRect.Left + 1, WRect.Bottom - 3);//replaced
            MoveTo(WRect.Left + 3, WRect.Bottom - 3);//KV
            LineTo(WRect.Left + 1 + CheckMarkWidth + ImageMargin.Left + ImageWidth + ImageMargin.Right + 1, WRect.Bottom - 3);
          end
          else
          begin
            //MoveTo(WRect.Left + 1, WRect.Top + 2); //replaced
            MoveTo(WRect.Left + 3, WRect.Top + 2); //KV
            LineTo(WRect.Left + 1 + CheckMarkWidth + ImageMargin.Left + ImageWidth + ImageMargin.Right, WRect.Top + 2);
            //MoveTo(WRect.Left + 1, WRect.Bottom - 3); // replaced
            MoveTo(WRect.Left + 3, WRect.Bottom - 3); //KV
            LineTo(WRect.Left + 1 + CheckMarkWidth + ImageMargin.Left + ImageWidth + ImageMargin.Right, WRect.Bottom - 3);
          end;
        end

(0009050)
marcgeldon (reporter)
2006-04-09 09:29

I have exactly the same problem (Menu1.jpg and Menu2.jpg) running the stuff under Windows XP (classic design).
(0009051)
marcgeldon (reporter)
2006-04-09 09:35

The same problem appears also with activated themes ("Windows XP")!
(0009052)
marcgeldon (reporter)
2006-04-09 09:39

There is also a problem with merged menus. Have a look at "Screenshot merged menus.jpg". If I have a MDI form and use the property "WindowMenu" from the MDI main form, then all MDI childs are shown there.

The menu looks like in the screenshot. Not really correct if you ask me.
(0009053)
obones (administrator)
2006-04-09 11:51

The merged menus are in 0003516 and I cannot do anything about it as the message is handled by the application main loop.
As to the rest, I know it is there, I'm seing it at various levels, but I have no direct way to fix this. I have one more thing to try, but I'm afraid this will stay in, in one way or the other.
(0009056)
marcgeldon (reporter)
2006-04-09 14:45

Are the problems shown in "Menu1.jpg" and "Menu2.jpg" also unfixable?
(0009057)
obones (administrator)
2006-04-09 15:36

They all have the same origin, due to Non client area repaint of the menu window. Basically, the border is repainted by the operating system itself and I get no message telling me that it did. There is one thing I have not yet tested: hooking into the message pump of the window used to draw menus. This might work, but has consequences that I am yet to assess. Will keep everyone posted.
(0009063)
obones (administrator)
2006-04-11 09:31

Ok, I FINALLY had time to test the last idea I got. This seems to work fine. Basically, the code hooks into the WndProc of the window that is used to draw the menu. Hence it receives WM_NCPAINT messages and can redraw the parts that are in the border when needed. Please try revision 1.87 from CVS and let me know how this goes.
(0009485)
obones (administrator)
2006-06-08 07:42

Well, no answers, I'm considering that this issue is fixed in the latest version:

http://jvcl.sf.net/daily/ [^]

- Issue History
Date Modified Username Field Change
2004-06-15 08:21 AlexeiR New Issue
2004-06-15 08:22 AlexeiR File Added: MenuBug1.gif
2004-06-15 08:22 AlexeiR File Added: MenuBug2.gif
2004-06-15 08:22 AlexeiR File Added: MenuBug3.gif
2004-07-05 00:17 obones Status new => assigned
2004-07-05 00:17 obones Assigned To => obones
2004-07-05 00:18 obones Note Added: 0004682
2004-07-05 23:21 obones Note Added: 0004696
2004-07-06 00:57 AlexeiR Note Added: 0004697
2004-07-06 01:31 xerkan File Added: Menu1.jpg
2004-07-06 01:31 xerkan File Added: Menu2.jpg
2004-07-06 01:32 xerkan Note Added: 0004698
2004-07-20 11:07 AlexeiR Note Added: 0004780
2004-08-05 23:17 obones Note Added: 0004945
2004-08-05 23:17 obones Status assigned => feedback
2004-08-06 02:24 user72 Note Added: 0004948
2004-08-06 02:31 obones Note Added: 0004949
2004-08-26 03:23 anonymous Note Added: 0005097
2004-10-15 00:30 obones Note Added: 0005395
2004-10-18 06:22 anonymous Note Added: 0005428
2004-11-23 09:48 anonymous Note Added: 0005693
2005-05-20 21:32 FlyingAvatar Note Added: 0007284
2005-05-20 21:35 FlyingAvatar File Added: viso_xp_menu_example.png
2005-05-21 06:40 obones Note Added: 0007289
2005-06-02 04:24 anonymous Note Added: 0007381
2005-06-02 05:38 anonymous Note Added: 0007383
2005-06-02 06:07 anonymous Note Added: 0007384
2005-06-02 06:10 anonymous Note Added: 0007385
2005-06-02 06:12 anonymous Note Deleted: 0007384
2005-06-02 06:13 anonymous Note Edited: 0007385
2005-06-02 06:14 anonymous Note Edited: 0007385
2005-07-31 09:43 obones Relationship added related to 0003124
2006-04-09 09:29 marcgeldon Note Added: 0009050
2006-04-09 09:35 marcgeldon Note Added: 0009051
2006-04-09 09:38 marcgeldon File Added: Screenshot merged menus.jpg
2006-04-09 09:39 marcgeldon Note Added: 0009052
2006-04-09 09:40 marcgeldon Issue Monitored: marcgeldon
2006-04-09 11:51 obones Note Added: 0009053
2006-04-09 14:45 marcgeldon Note Added: 0009056
2006-04-09 15:36 obones Note Added: 0009057
2006-04-11 09:31 obones Note Added: 0009063
2006-06-08 07:42 obones Status feedback => resolved
2006-06-08 07:42 obones Resolution open => fixed
2006-06-08 07:42 obones Note Added: 0009485


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker