TActionMainMenuBar painting bug when VCL Styles are enabled
There is a critical and easy to reproduce bug in TActionMainMenuBar that only happens when VCL Styles are enabled and I wonder if someone has already seen it and found any workaround. I'm using the latest Delphi 10.3.3 Rio (also happens on 10.4.1 Sydney), and not using High-DPI monitor.
Steps to recreate it:
- Create a new Delphi VCL application. Enable VCL Styles via Project Options. Assign any built-in style to it.
- Add 3 components to it: TActionManager, TActionMainMenuBar and a TCustomizeDlg. Link TActionMainMenuBar and TActionManager through ActionManager property. Also link TCustomizeDlg to the ActionManager.
- Now, add a few actions to the ActionManager component. In my example, I added 4 DataSet standard actions + 3 Dialog standard actions.
- Drag & drop the newly created actions to the ActionMainMenuBar so there are now 2 top menu items, the first with 4 actions and the second with 3 actions. See image
![enter image description here](https://i.sstatic.net/8bEKS.png)
- Now add this code to some user triggered event (I used the ActionMainMenuBar DblClick event):
procedure TForm9.ActionMainMenuBar1DblClick(Sender: TObject);
begin
CustomizeDlg1.Show;
end;
- Run the application and double-click on the ActionMainMenuBar. The CustomizeDlg is shown and the action main menu bar enters in Design Mode, allowing you to customize it.
- Drag one action from the dialog and move the mouse over the second top menu item (it will drop down and all 3 items will be visible). See the image below:
![enter image description here](https://i.sstatic.net/zkPlN.png)
- Now move the mouse to the other top menu action (DataSet in that example) and move it back to the Dialog menu item. Now the painting of the menus is completely broken:
![enter image description here](https://i.sstatic.net/h2ZKs.png)
From now on, painting of menus is broken until you close the CustomizeDlg.
What I know so far:
- The problem doesn't happen if VCL Styles are not enabled.
- The bug is not related to the CustomizeDlg but to the ActionMainMenuBar when it goes into DesignMode (The ancestor TCustomActionBar has a property named DesignMode).
- It happens at least in Delphi 10.3.3 Rio and 10.4.1 Sydney. Probably others
Unfortunately, debugging this kind of scenario is extremely time-consuming and sometimes it is not possible to debug it directly (debugging itself changes the scenario when dealing with mouse messages, etc.)
Is there any known fix, patch or workaround (other than disabling the VCL Styles which is not an option)?