Jump to content


Photo

Need Help


  • Please log in to reply
2 replies to this topic

#1 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 19 October 2009 - 01:18 AM

Dear Users,

I am having one small problem with using XP/Vista Themes Support in my components.

For some reason when I change from XP Classic to XP Themed theme, components such as TNxButton are no longer painted correctly.

Does anymody know how to solve this. Is there a some event which occur when system theme is changed, to recreate current theme.

Thanks for any tips.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#2 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 19 October 2009 - 08:50 AM

Hi Boki

This is from another component set that I use, which "adapts" to theme changes:

CODE
const
  WM_THEMECHANGED = $031A;


CODE
procedure TSomething.WndProc(var Msg: TMessage);
begin
  if Msg.Msg = WM_THEMECHANGED  then
  begin
    if Assigned(FOnThemeChange) then
      FOnThemeChange(Self);
  end;
  inherited;
end;


Hope it helps.....

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 19 October 2009 - 04:53 PM

Hello Deon,

Thank you for your help, this worked smile.gif

I have done slightly different method:

In NxClasses.pas I have write:

CODE
const
  exIndexOutOfBounds = 'Index out of bounds (%d) for %s.';
{$IFDEF VER140}
  WM_THEMECHANGED = $031A;
{$ENDIF}


Then, in NxCustomGridControl.pas write:

CODE
procedure TNxCustomGridControl.WMThemeChanged(var Message: TMessage);
begin
  inherited;
  CloseThemeData(FTheme);
  FTheme := OpenThemeData(Handle, teHeader);
  FDefaultStyleDisplay.Theme := FTheme;
end;


I hope that this approach is fine too smile.gif

Again, thank you for your help!

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users