Forum > Windows

Main menu flickers badly in IDE and apps generated by it.

<< < (6/6)

lainz:

--- Quote from: 440bx on December 11, 2022, 12:12:26 am ---I suspect the problem resides somewhere inside Windows 10/11 because on Win 7 there does not seem to be a way to make the menu flicker.

--- End quote ---

On Windows 11 there's like a black popup in top of the screen that shows where to position the form, maybe that causes the flickering...

440bx:

--- Quote from: jamie on December 11, 2022, 12:37:55 am ---My Windows 7 box with the I7, 12G memory and lots of HD space flickers, too.

--- End quote ---
On my Win7  VM, I cannot make the menu flicker.  On the Win10 VM, it flickers plenty.  Exactly why the difference ?... no idea, other than the different version of Windows.

GetMem:
From Win32WSMenus.pp:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  // draw backgound  // This is a hackish way to draw. Seems windows itself draws this in WM_PAINT or another paint handler?  AWnd := TCustomForm(AMenuItem.GetMergedParentMenu.Parent).Handle;  if (AMenuItem.MergedParent.VisibleIndexOf(AMenuItem) = 0) then  begin    /// if we are painting the first item then request full repaint to draw the bg correctly    if (GetProp(AWnd, 'LCL_MENUREDRAW') = 0) then    begin      SetProp(AWnd, 'LCL_MENUREDRAW', 1);      DrawMenuBar(AWnd);      Exit;    end    else      SetProp(AWnd, 'LCL_MENUREDRAW', 0);    // repainting menu bar bg    Info := Default(tagMENUBARINFO);    Info.cbSize := SizeOf(Info);    GetMenuBarInfo(AWnd, OBJID_MENU, 0, @Info);    GetWindowRect(AWnd, @WndRect);    OffsetRect(Info.rcBar, -WndRect.Left, -WndRect.Top);    Tmp := ThemeServices.GetElementDetails(BarState[(ItemState and ODS_INACTIVE) = 0]);    ThemeDrawElement(AHDC, Tmp, DPI, Info.rcBar, nil);        

jamie:
That would explain why I couldn't get one of my Delphi apps to work properly because there I had a little status display in the menu bar and it wouldn't show using Lazarus, but I would notice once in a while I could see a glimpse of it.

  I don't know why or who put that code in there like that but it's true that windows does draw its own menu bar unless you have it in Owner Draw mode.

 It seems here that attempts are being made to overwrite what would possibly be there so that the LCL could use its own menu bar.

 I was under the impression the LCL always creates the menu bar in owner Draw mode and simply passes it to user code if the user wants to draw it instead?

 In Owner mode there is no need to attempt overwriting an existing menu bar.

jamie:
Any headway on this?

Navigation

[0] Message Index

[*] Previous page

Go to full version