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 » RibbonBar: Umlaut in mnemonics? Collapse All
Subject Author Date
Oliver Rau Mar 30, 2009 - 9:55 AM

Dear ProfUIS-Team,


is it possible to use umlauts in ribbonbar mnemonics - e.g. the "Open File"-Button (OF) should be localized as "Datei öffnen" (DÖ) for German.


Best regards,


Martin


P.S.: We’re still using ProfUIS 2.82


 

Technical Support Mar 31, 2009 - 10:38 AM

Thank you for the interesting question. Here is how to do this:
1) Please insert the following class into your project:

class CMyKeyTip : public CExtCustomizeCmdKeyTip
{
public:
            DECLARE_SERIAL( CMyKeyTip );
            CMyKeyTip() {  }
            CMyKeyTip( const CMyKeyTip & other ) : CExtCustomizeCmdKeyTip( other ) { }
            CMyKeyTip( __EXT_MFC_SAFE_LPCTSTR str ) : CExtCustomizeCmdKeyTip( str ) { }
            CMyKeyTip( __EXT_MFC_SAFE_TCHAR _tchr ) : CExtCustomizeCmdKeyTip( _tchr ) { }
            virtual ~CMyKeyTip() { }
            virtual CExtSafeString GetTipText( INT nIndent ) const
            {
                        ASSERT_VALID( this );
                        HKL hKeyboardLayout = ::GetKeyboardLayout( ( ::AfxGetThread() ) -> m_nThreadID );
                        CExtSafeString strTipText( _T("") );
                        INT nIndex, nCount = KeyCodeGetCount();
                        for( nIndex = nIndent; nIndex < nCount; nIndex ++ )
                        {
                                    DWORD dwKeyCode = KeyCodeGetAt( nIndex );
                                    TCHAR vkTCHAR = (TCHAR)dwKeyCode;
                                    BYTE lpKeyState[256];
                                    ::GetKeyboardState( lpKeyState );
                                    UINT wScanCode = ::MapVirtualKey( vkTCHAR, 0 );
#if (defined _UNICODE)
                                    TCHAR szChar[2] = { _T(’\0’), _T(’\0’) };
                                    ::ToUnicodeEx( vkTCHAR, wScanCode, lpKeyState, szChar, 1, 1, hKeyboardLayout );
#else
                                    WORD nMapped = 0;
                                    ::ToAsciiEx( vkTCHAR, wScanCode, lpKeyState, &nMapped, 1, hKeyboardLayout );
                                    TCHAR szChar[2] = { (TCHAR)nMapped, _T(’\0’) };
#endif
                                    ::CharUpper( szChar );
                                    strTipText += szChar;
                        }
                        return strTipText;
            }
};

IMPLEMENT_SERIAL( CMyKeyTip, CExtCustomizeCmdKeyTip, VERSIONABLE_SCHEMA|1 );

2) Please use the CMyKeyTip class instead of theCExtCustomizeCmdKeyTip class in the initialization code for all the ribbon nodes. You should specify English letters while initializing key tip texts.
3) Remove the application state from the system registry.
Now the ribbon bar will display key tips using currently selected keyboard input language. Is that what you need?