Happened yesterday:

Happened yesterday:

Workaround found for the FMX TMainMenu Visibility problem!

On the touch screen you don't want the menu, except for the case when you 'temporarily need it'.

So, you build the menu at runtime, then destroy and recreate via touch button.

Recreation will result in a firework, flicker and flacker for about 4 seconds, because RecreateOSMenu is called for each TMenuItem you add.

Implementation section only workaround:

procedure TMainMenu.RecreateOSMenu;
var
Form: TOpenCustomForm;
begin
if (Tag > -1) //trick
and ([csDestroying] * ComponentState = []) then
begin
...
end;
end;

//from the test app...
procedure TFormMain.SetMainMenuVisible(const Value: Boolean);
begin
if Value and not Assigned(MainMenu) then
begin
MainMenu := TMainMenu.Create(self);
MainMenu.Tag := -1
MainMenu.Parent := self;
PopulateMenu; //custom code
UpdateMenu; //custom code
MainMenu.Tag := 1;
MainMenu.RecreateOSMenu; //once
end
else if Assigned(MainMenu) and not Value then
begin
MainMenu.Free;
MainMenu := nil;
end;
end;

Have you seen menu flicker in other situations?
Do you want a visible property?
Do you want to build a minimal test case and report it?

(My test case is too long; I use my real populate menu code.)

Comments