Jump to content
dummzeuch

Dark mode for TMainMenu

Recommended Posts

I am trying to fix the remaining glitches in GExperts to follow the IDE's dark/light mode setting (which was implemented by @Achim Kalwa, Thanks a lot Achim!). One thing that does not work is dark mode for a TMainMenu. The menu bar itself is not themed, but its sub menus are themed as expected.

 

Is that a bug in the VCL? A problem that only happens in IDE plugins? Or PEBKAC ?

 

image.thumb.png.60fce77d871a2be13a5aea73b275ddfa.png

Share this post


Link to post
4 hours ago, dummzeuch said:

Is that a bug in the VCL?

It's probably because TMainMenu is not themed in the IDE. As you probably know, the IDE itself uses TActionMainMenuBar, which is themed. Curious that submenu items are themed, though.

Share this post


Link to post

Even a TMainMenu is drawn according to the current VCL style. A simple test confirms that. 

 

So, what class type has the form and is that class registered to the ThemingServices?

Share this post


Link to post
10 hours ago, Uwe Raabe said:

Even a TMainMenu is drawn according to the current VCL style. A simple test confirms that. 

 

So, what class type has the form and is that class registered to the ThemingServices?

The form is a TfmClassBrowser, which descends from TfmBaseForm which in turn descends from TForm.

 

It calls this function passing Self as parameter:

function GxOtaInitTheming(AForm: TCustomForm): Boolean;
var
  LService : IOTAIDEThemingServices;
begin
  Result := False;
  LService := GxOtaGetIDEThemingServices;
  if Assigned(AForm) and Assigned(LService) and (LService.IDEThemingEnabled) then
  begin
    LService.RegisterFormClass(TCustomFormClass(AForm.ClassType));
    LService.ApplyTheme(AForm);
    Result := True;
  end;
end;

Which is what I think you mean by "registered to the ThemingService".

 

I also tried explicitly calling IOTAIDEThemingServices.ApplyTheme for the TMainMenu, but it didn't have any effect.

Edited by dummzeuch

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×