View Issue Details

IDProjectCategoryView StatusLast Update
0001862JEDI VCL00 JVCL Componentspublic2006-06-08 07:43
ReporterAlexeiRAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.30 
Summary0001862: JvMainMenu: strange drawing in XP Style
DescriptionI'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.
TagsNo tags attached.

Relationships

related to 0003124 closed TJvXPMenuItemPainter Paint Error 

Activities

2004-06-15 08:22

 

MenuBug1.gif (9,349 bytes)
MenuBug1.gif (9,349 bytes)

2004-06-15 08:22

 

MenuBug2.gif (9,497 bytes)
MenuBug2.gif (9,497 bytes)

2004-06-15 08:22

 

MenuBug3.gif (9,123 bytes)
MenuBug3.gif (9,123 bytes)

obones

2004-07-05 00:18

administrator   ~0004682

Note to me: It seems the drawing of the border is not done when not selecting an item. Will investigate.

obones

2004-07-05 23:21

administrator   ~0004696

I cannot reproduce this. Does this happen at Runtime ?

AlexeiR

2004-07-06 00:57

reporter   ~0004697

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.

2004-07-06 01:31

 

Menu1.jpg (24,736 bytes)
Menu1.jpg (24,736 bytes)

2004-07-06 01:31

 

Menu2.jpg (23,998 bytes)
Menu2.jpg (23,998 bytes)

xerkan

2004-07-06 01:32

reporter   ~0004698

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

Show images Menu1.jpg and Menu2.jpg

AlexeiR

2004-07-20 11:07

reporter   ~0004780

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).

obones

2004-08-05 23:17

administrator   ~0004945

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.

user72

2004-08-06 02:24

  ~0004948

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.

obones

2004-08-06 02:31

administrator   ~0004949

No, it doesn't, I turned off all theme support under XP.

anonymous

2004-08-26 03:23

viewer   ~0005097

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.

obones

2004-10-15 00:30

administrator   ~0005395

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.

anonymous

2004-10-18 06:22

viewer   ~0005428

It's strange again but the bug seems doesn't appears under XP even when effects is turned on...

anonymous

2004-11-23 09:48

viewer   ~0005693

The menu shows the same error... but there is Windows XP SP1. So the bug appears on Windows XP as well.

FlyingAvatar

2005-05-20 21:32

reporter   ~0007284

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.

2005-05-20 21:35

 

viso_xp_menu_example.png (3,966 bytes)
viso_xp_menu_example.png (3,966 bytes)

obones

2005-05-21 06:40

administrator   ~0007289

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.

anonymous

2005-06-02 04:24

viewer   ~0007381

I get the same bug (MenuBug1-3) on an XP system with theming enabled when using XP menu style.

anonymous

2005-06-02 05:38

viewer   ~0007383

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;

anonymous

2005-06-02 06:10

viewer   ~0007385

Last edited: 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

marcgeldon

2006-04-09 09:29

reporter   ~0009050

I have exactly the same problem (Menu1.jpg and Menu2.jpg) running the stuff under Windows XP (classic design).

marcgeldon

2006-04-09 09:35

reporter   ~0009051

The same problem appears also with activated themes ("Windows XP")!

2006-04-09 09:38

 

marcgeldon

2006-04-09 09:39

reporter   ~0009052

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.

obones

2006-04-09 11:51

administrator   ~0009053

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.

marcgeldon

2006-04-09 14:45

reporter   ~0009056

Are the problems shown in "Menu1.jpg" and "Menu2.jpg" also unfixable?

obones

2006-04-09 15:36

administrator   ~0009057

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.

obones

2006-04-11 09:31

administrator   ~0009063

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.

obones

2006-06-08 07:42

administrator   ~0009485

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 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