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 Tech Support » Regarding fonts used in ProfUIS controls Collapse All
Subject Author Date
Suhai Gyorgy Sep 13, 2007 - 7:41 AM

Dear Support,

Our application’s main structure is similar to your SimpleGrids sample. It seems to me that the font used in the grid is different from the font used on the tabs of the TabPageContainer, even though no code in our application (or in SimpleGrids application) changes the font. Shouldn’t all ProfUIS controls use the same default font? If not, what was the reason you chose another font for either the grid or the tabs? What code should we add to our application to have the same font used in both controls?

Thank you!
Chris

Technical Support Sep 13, 2007 - 10:37 AM

There is a g_PaintManager->m_FontNormal stored in the global paint manager, which controls the font used In most of Prof-UIS controls. But some Prof-UIS controls when placed on a dialog use the parent dialog’s font. In the latter case, you can assign a custom font using the CWnd::SetFont() method.

Suhai Gyorgy Sep 13, 2007 - 11:33 AM

As I wrote in the first post, these controls are not on a dialog. Just start your SimpleGrids sample (which is not dialog based application) and check out the fonts used in the grids and on the tabs of the TabPageContainer. They are different. So at least one of them is not using g_PaintManager->m_FontNormal. Which of them should I change and how to produce the same fonts? (I’d prefer the font used on the tab items but if you could show me the other way around, as well, it’d be great)

BTW, regarding your answer: when a grid is placed on a dialog, the font used in the grid is not the same as on the dialog. I need to call m_wndGrid->SetFont(GetFont(), false); manually in OnInitDialog.

Best regards,
Chris

Technical Support Sep 14, 2007 - 11:23 AM

Here is the method that is used for retrieving a font in the tab page container:

HFONT CExtTabPageContainerWnd::OnQueryFont() const
{
	ASSERT_VALID( this );
HFONT hFont = (HFONT)
		::SendMessage( m_hWnd, WM_GETFONT, 0L, 0L );
	if( hFont == NULL )
	{
		HWND hWndParent = ::GetParent( m_hWnd );
		if( hWndParent != NULL )
			hFont = (HFONT)
				::SendMessage( hWndParent, WM_GETFONT, 0L, 0L );
	} // if( hFont == NULL )
	if( hFont == NULL )
	{
		hFont = (HFONT)::GetStockObject( DEFAULT_GUI_FONT );
		if( hFont == NULL )
			hFont = (HFONT)::GetStockObject( SYSTEM_FONT );
	} // if( hFont == NULL )
	return hFont;
}
In the grid window, some other method is used:
CFont & CExtScrollItemWnd::OnSiwGetDefaultFont() const
{
	ASSERT_VALID( this );
CFont * pFont = NULL;
	if( GetSafeHwnd() != NULL )
		pFont = GetFont();
	return ( pFont->GetSafeHandle() != NULL ) ? (*pFont) : PmBridge_GetPM()->m_FontNormal;
}
So, in the first case is the font specified with DEFAULT_GUI_FONT and in the second case is is m_FontNormal.

You can override OnSiwGetDefaultFont() in your grid window and make it the same as CExtTabPageContainerWnd::OnQueryFont().

As for your comment, yes, we agree with you.