Get and set menu item & toolbar button tooltip text - Programmer

This is a discussion on Get and set menu item & toolbar button tooltip text - Programmer ; I need to retrieve the Prompt string from all the menu items and toolbar buttons in my MFC application. Once I retieve the string, I'm going to translate it and then set it to the translated string. (Note that the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Get and set menu item & toolbar button tooltip text

  1. Get and set menu item & toolbar button tooltip text

    I need to retrieve the Prompt string from all the menu items and
    toolbar buttons in my MFC application. Once I retieve the string, I'm
    going to translate it and then set it to the translated string.

    (Note that the Prompt string contains text to appear in the status bar
    when this menu item is highlighted, and also contains the tooltip
    text.)

    So, I need something like...

    myMenuItem->GetPromptText(string);
    myMenuItem->SetPromptText(translatedString);

    Does anyone know how to do this?

  2. Re: Get and set menu item & toolbar button tooltip text

    Don't do this. Make language depend resources. See in MSDN library the
    article Multiple-Language Resources.
    The toolbar text is find in the rc file.

    Here is a sample changing the user interface at runtime but this is only
    working on NT and XP:
    I have copy the dialog template IDD_ABOUTBOX from english to dutch language
    and translate it.
    You can easy translate a rc file because it is a text document!

    // ---

    DWORD CEx18aApp::MakeLCID(WORD wPrimary, WORD wSubLang)
    {
    BYTE byPrimary = PRIMARYLANGID( wPrimary );
    BYTE bySubLang = SUBLANGID( wSubLang );
    WORD wLangId = MAKELANGID( byPrimary, bySubLang );
    DWORD dwLcid = MAKELCID(wLangId, SORT_DEFAULT);
    return dwLcid;
    }


    // App command to run the dialog
    void CEx18aApp::OnAppAbout()
    {
    DWORD dwOldLcid = GetThreadLocale();
    SetThreadLocale ( MakeLCID(LANG_DUTCH, SUBLANG_DUTCH ));

    // showing the dutch dialog
    CAboutDlg aboutDlg;
    aboutDlg.DoModal();

    SetThreadLocale ( MakeLCID(LANG_ENGLISH, SUBLANG_ENGLISH_US ));

    // showing the english dialog
    CAboutDlg aboutDlg2;
    aboutDlg2.DoModal();

    SetThreadLocale (dwOldLcid);
    }

    // ---


    Tim wrote in message
    news:f7da307b.0402170821.6d4a2f1a@posting.google.c om...
    > I need to retrieve the Prompt string from all the menu items and
    > toolbar buttons in my MFC application. Once I retieve the string, I'm
    > going to translate it and then set it to the translated string.
    >
    > (Note that the Prompt string contains text to appear in the status bar
    > when this menu item is highlighted, and also contains the tooltip
    > text.)
    >
    > So, I need something like...
    >
    > myMenuItem->GetPromptText(string);
    > myMenuItem->SetPromptText(translatedString);
    >
    > Does anyone know how to do this?




+ Reply to Thread