Take the 2-minute tour ×

A MainMenu option in my app calls:

    TStyleManager.SetStyle('Ruby Graphite');

It properly changes the style in my XE2 (Update 3) application almost everywhere. Here's the problem:

I have a TPageControl with 3 TabSheets, each containing a TFrame. The above call properly changes the style of the currently visible TabSheet's components to 'Ruby Graphite'.

However, when I click to switch to another tabsheet, all of its components are invisible until I move my mouse over them. When I return to the original TabSheet, its components too are now not visible until I hover over them.

I tried explicitly calling .Refresh and .Repaint on the frames themselves, but that didn't make the components on them visible.

What's weird is that executing:


returns the style to the standard, with all components visible.

The TTabSheet is on a panel which is on a panel, if that matters. And, I'm using some 3rd party components (not in these frames) that are threaded. I believe that I have disabled them though.

Any suggestions on how to force the visual components on a formerly hidden tab to become visible after changing the style from Windows?

EDIT: Link to short screen video that shows the refresh problem: http://tinyurl.com/sostyle.

I have also on occasion found that the software doesn't respond when clicking on the icons (like maximize) in the upper right corner. There's just something weird going on that is over my head. So far, I've been unable boil this down to a small example from the 40,000 lines of code in the application.

share|improve this question
I can't reproduce your issue, can you give more information about how you attach the frames to the tabsheets? or maybe provide a minimal code to reproduce the issue? –  RRUZ Jan 4 '12 at 5:21
I haven't been able to reproduce it in a small, standalone program. It's only happening in my large app, which is tough to strip down. I'll keep trying. Thanks for trying, RRUZ. In case seeing it happen in any way, here's a short screen recording of it happening: tinyurl.com/sostyle –  RobertFrank Jan 4 '12 at 16:11

1 Answer 1

Here's a solution and a direction to try that worked for me on Delphi XE4.

I have found that I get the same issues when I minimize a form that is set to use the TStyleManager and sets styles dynamically during the execution of the application.

Another problem besides the redraw problem that I noticed is one that involves the form style not being set to a sizeable when the form is restored from being minimized to the taskbar or a trayicon. The sizeable form border problem and the redraw problem seem to be linked.

I overcame the redraw problem and the border resizing problem by adding an event handler for the OnClick event of the TrayIcon component and calling RecreateWnd for the form that uses the TStyleManager.

Currently it looks like this, with the jtiApp component being a TJvTrayIcon component:

procedure TMainForm.jtiAppClick(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
  if not Visible then
    WindowState := wsNormal;

That seems to take care of the redraw problem and the border settings for the recreated form. I'm not sure if that's a JVCL issue or with the TStyleManager but that fix worked when it was an issue dealing with a restore from the tray via a TrayIcon component.

I hope that helps with your issue and others who view this solution.

share|improve this answer

Your Answer


