3

I am assuming that this is a bug I have to work around in TCustomActionBar that forgets about the custom colors maps each time a CM_SYSFONTCHANGED message comes in.

Looking at TCustomActionBar.CMSysFontChanged(var Message: TMessage) it calls AdjustSize, then SetColorMap(nil), then RecreateControls. There appears to be no provision in the design of the class to remember the published property ColorMap in my TActionMainMenuBar

Is there an easy workaround? IT seems I would have to be checking a lot for this condition? SHould I be hooking CM_SYSFONTCHANGED myself in a descendant class or local interposing class?

Has anyone tried this and seen if this breaks the TCustomActionBar in some other way? Is this VCL functionality essential, stupid, or a mixture of both?

My interposing class hack, which appears to work is this, is that the right way to fix it, and is there any way I can figure out where that CM_SYSFONTCHANGED message came from or any authoritative source of the various sub-meanings it might have (WPARAM and LPARAM are always zero)?

procedure TActionMainMenuBar.CMSysFontChanged2(var Message: TMessage);
begin
  { hacked version of Vcl.ActnMan }
    if not (csLoading in ComponentState) then
  begin
    AdjustSize;
    //SetColorMap(nil);  // don't want this!
    RecreateControls;
  end;
end;
Warren P
  • 65,725
  • 40
  • 181
  • 316
  • 3
    If I remember correctly, [this question](http://stackoverflow.com/questions/9577540/tactionmainmenubar-and-tactiontoolbar-lose-settings) has some solution, but although my answer was accepted I think the solution should be in poster's comments and answer. Not sure if it would be better than yours but you may evaluate it. – Sertac Akyuz Oct 03 '13 at 19:27
  • 1
    I'm a bit mystified why I'm even seeing CM_SYSFONTCHANGED messages get sent to my form, when I'm not doing anything that should result in that happening, like going into Windows settings and changing system font sizes or font faces. – Warren P Oct 04 '13 at 02:15
  • I can so far confirm that my posted hack above appears to work around the problem. – Warren P Oct 06 '13 at 18:41

0 Answers0