View Issue Details

IDProjectCategoryView StatusLast Update
0037595LazarusIDEpublic2020-09-05 12:37
Reporterwp Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Summary0037595: Menu item drawing issue during adding a menu separator
DescriptionWhen a new menu item is added to a menu is takes a short time until the menu is updated. If a separator line as added the neighboring menu item is erroneously displayed also in the space to be occupied by the separator. When a regular menu item is added this does not happen
Steps To ReproduceAdd a TMainMenu to a form
Open the menu editor and add several menu items.
Select one of the inner items and click on one of the buttons in the second button column of the menu editor in order to add a separator above or below the selected item
During the time the menu is rebuilt the selected item is drawn in the space to be occupied by the separator; this should not happen.

See attached screenshot.
Additional InformationBeginning with Laz trunk r63791 I checked back to v1.8.4 - all versions show the issue (v1.6.x has still the old menu editor).

I see the issue clearly on Win 10. On Manjaro Linux, on the other hand, the separator line appears immediately, no duplicate drawing of the selected menu item - it is not clear to me, however, whether this is a consequence of the menu building process appearing to be considerably faster in Manjaro than in Windows
TagsNo tags attached.
Fixed in Revisionr63802, r63803
LazTarget-
Widgetset
Attached Files

Relationships

related to 0037706 closedJuha Manninen [Regression] IDE extremely slow when adding a new control to a heavily populated form 

Activities

wp

2020-08-19 15:01

developer  

menu_separator_issue.png (8,112 bytes)   
menu_separator_issue.png (8,112 bytes)   

BrunoK

2020-08-21 11:16

reporter   ~0125054

@wp

WIN 10, v. 2004 (19041.450, suppose the latest).

1° I also see the artefact on inserting the first separator.

2° right click a separator -> Separators -> click Remove all separators gives me a "External: SIGSEGV"
   Does it also happen on your system ?

Juha Manninen

2020-08-21 12:14

developer   ~0125058

> 2° right click a separator -> Separators -> click Remove all separators gives me a "External: SIGSEGV"

Actually that was an Assert() line. Please try with r63802.

BrunoK

2020-08-21 14:27

reporter   ~0125063

@Juha r63802 ok for SIGSEGV

Attached patch should solve :

1° I also see the artefact on inserting the first separator. -> DisableAutoSizing + EnableAutoSizing, lines 2048 - 2066

3° There was also a display problem deleting all separators from a valid menu item in TShadowBox.RemoveAllSeparators. Solved by refreshing item's positions. Also decided that the selected item is the one that was last selected or the nearest next one if possible.
menueditor.pp.patch (1,488 bytes)   
Index: designer/menueditor.pp
===================================================================
--- designer/menueditor.pp	(revision 63802)
+++ designer/menueditor.pp	(working copy)
@@ -2007,10 +2007,15 @@
   if (sepCount > 0) then begin
     FShadowMenu.HideFakes;
     ShowAllUnSelected;
-    nearestMI:=GetNextNonSepItem(FShadowMenu.SelectedMenuItem);
+    nearestMI:=FShadowMenu.SelectedMenuItem;
+    if assigned(nearestMI) and nearestMI.IsLine then begin
+      nearestMI:=GetNextNonSepItem(FShadowMenu.SelectedMenuItem);
+      if (nearestMI = nil) then
+        nearestMI:=GetPreviousNonSepItem(FShadowMenu.SelectedMenuItem);
+    end
+    else
+      FShadowMenu.SelectedMenuItem := nil;
     if (nearestMI = nil) then
-      nearestMI:=GetPreviousNonSepItem(FShadowMenu.SelectedMenuItem);
-    if (nearestMI = nil) then
       nearestMI:=FParentMenuItem;
     for i:=ParentMenuItem.Count-1 downto 0 do
     begin
@@ -2030,6 +2035,7 @@
     else begin
       FShadowMenu.UpdateBoxLocationsAndSizes;
       FShadowMenu.SetSelectedMenuItem(nearestMI, False, True);
+      LocateShadows;
     end;
   end;
 end;
@@ -2042,6 +2048,7 @@
   if (ShadowList.Count = 0) then
     Exit;
   FShadowList.Sort(@SortByItemMenuIndex);
+  DisableAutoSizing;
   if IsMenuBar then begin
     len:=0;
     for si in FShadowList do begin
@@ -2059,6 +2066,7 @@
       Inc(t, h);
     end;
   end;
+  EnableAutoSizing;
 end;
 
 constructor TShadowBox.CreateWithParentBox(aSMenu: TShadowMenu;
menueditor.pp.patch (1,488 bytes)   

Juha Manninen

2020-08-21 18:06

developer   ~0125064

Applied in r63803. Thanks.
It looks good. Are all the errors fixed now?

wp

2020-08-21 22:11

developer   ~0125065

Thank for the fixes. Yes, looks good.

Juha Manninen

2020-08-22 09:48

developer   ~0125073

Ok, resolving.

BrunoK

2020-08-22 11:31

reporter   ~0125075

Note to myself : looks good but still a slight hiccup when inserting the first separator in a lazarus session.

Will not dig further why.

wp

2020-08-22 11:53

developer   ~0125076

Thanks to BrunoK and Juha.

Issue History

Date Modified Username Field Change
2020-08-19 15:01 wp New Issue
2020-08-19 15:01 wp File Added: menu_separator_issue.png
2020-08-19 15:09 wp Additional Information Updated View Revisions
2020-08-19 15:09 wp LazTarget => -
2020-08-21 11:16 BrunoK Note Added: 0125054
2020-08-21 12:14 Juha Manninen Note Added: 0125058
2020-08-21 14:27 BrunoK Note Added: 0125063
2020-08-21 14:27 BrunoK File Added: menueditor.pp.patch
2020-08-21 18:04 Juha Manninen Assigned To => Juha Manninen
2020-08-21 18:04 Juha Manninen Status new => assigned
2020-08-21 18:06 Juha Manninen Note Added: 0125064
2020-08-21 22:11 wp Note Added: 0125065
2020-08-22 09:48 Juha Manninen Status assigned => resolved
2020-08-22 09:48 Juha Manninen Resolution open => fixed
2020-08-22 09:48 Juha Manninen Fixed in Revision => r63802, r63803
2020-08-22 09:48 Juha Manninen Note Added: 0125073
2020-08-22 11:31 BrunoK Note Added: 0125075
2020-08-22 11:53 wp Status resolved => closed
2020-08-22 11:53 wp Note Added: 0125076
2020-09-05 12:37 wp Relationship added related to 0037706