Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Notification message for theme changing Collapse All
Subject Author Date
Pavel Pavlov Aug 9, 2005 - 6:57 PM

How you implement updating controls when theme has been changing? If I make own control how I should to catch this event?

Technical Support Aug 10, 2005 - 12:59 PM

The code responsible for changing Prof-UIS themes simply invalidates all the windows which need to be redrawn. This action depends on whether your application is dialog-based or frame-based. The CMainDlg::OnSelendokComboUiLook() method in the ProfUIS_Controls application redraws everything inside the main dialog window and lets toolbars to re-compute their non-client areas. If you code a frame based application, then the following code updates everything both in the main frame window and in all the floating mini frame windows:

void CMainFrame::OnSetSomeTheme() 
{
    VERIFY(
        g_PaintManager.InstallPaintManager(
            new CExtPaintManager . . .
            )
        );
    RecalcLayout();
    RedrawWindow(
        NULL,
        NULL,
        RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE
        | RDW_FRAME | RDW_ALLCHILDREN
        );
    CExtControlBar::stat_RedrawFloatingFrames( this );
    CExtControlBar::stat_RecalcBarMetrics( this );
}

Tor Erik Ottinsen Sep 21, 2005 - 8:23 AM

I have a dialog based application with numerous modal and som non-modal dialogs. From a preferences dialog, I have included an option to change the theme. How do I update all open dialogs to use the new theme if I do not know which dialogs are currently open?

Technical Support Sep 21, 2005 - 9:07 AM

You should use a global array of pointers to your dialog windows. Each dialog should add itself to this array in the OnInitDialog() virtual method and remove itself from the global array in the PostNcDestroy() virtual method. This will let your code to know exactly all the currently created windows in your application and you can repaint each of them by invoking:

CWnd::RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );