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 » Language Switching ( String Table Loading ) Collapse All
Subject Author Date
Seung Cheol Lee Aug 24, 2006 - 7:07 PM

I have used the sample source ’Language Switcher’. When to change language, the problem was happend. The problem is that some string ( ID_FILE_NEW, ID_FILE_OPEN and etc.) do well, but the other (AFX_IDS_IDLEMESSAGE, user defined string ID and etc.) does’t. I could’t find the reson.

===============================================================================================================
int    CMainFrame::OnCreate (LPCREATESTRUCT lpCreateStruct)
{
    if (CExtNCW < CFrameWnd >::OnCreate(lpCreateStruct) == -1)    return -1;

    CWinApp * pApp = ::AfxGetApp();
    ASSERT (pApp != NULL);
    ASSERT (pApp->m_pszRegistryKey != NULL);
    ASSERT (pApp->m_pszRegistryKey[0] != _T(’\0’));
    ASSERT (pApp->m_pszProfileName != NULL );
    ASSERT (pApp->m_pszProfileName[0] != _T(’\0’));
    ASSERT (pApp->m_pszProfileName != NULL);

    g_CmdManager->ProfileSetup (pApp->m_pszProfileName,    GetSafeHwnd());
    
    VERIFY (_UpdateCommandManager());

    HICON hIcon = pApp->LoadIcon (IDR_MAINFRAME);
    ASSERT (hIcon != NULL);
    SetIcon (hIcon, TRUE);
    SetIcon (hIcon, FALSE);

    g_CmdManager->ProfileSetup (pApp->m_pszProfileName,    GetSafeHwnd());
    
    VERIFY (_UpdateCommandManager());

    //VERIFY (g_CmdManager->ProfileWndAdd (__PROF_UIS_PROJECT_CMD_PROFILE_NAME, GetSafeHwnd()));
    //VERIFY (g_CmdManager->UpdateFromMenu (__PROF_UIS_PROJECT_CMD_PROFILE_NAME, IDR_MAINFRAME));

    // Menu Control Bar
    if (!m_wndMenuBar.Create (_T("Menu Bar"),
            this, IDM_VIEW_MENUBAR, WS_CHILD|WS_VISIBLE
                |CBRS_TOP|CBRS_TOOLTIPS|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
                )
        ) {
TRACE0 ("Failed to create menubar\n");
return -1; // failed to create
}

    m_wndToolBar.m_bCustomizationAllowed = false;
    if (!m_wndToolBar.Create (_T("Main Toolbar"),
            this, AFX_IDW_TOOLBAR,
            WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
            | CBRS_TOOLTIPS | CBRS_HIDE_INPLACE
            ) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)
        ) {
        TRACE0 ("Failed to create toolbar\n");
        return -1; // fail to create
    }

    m_measToolBar.m_bCustomizationAllowed = false;
    if (!m_measToolBar.Create (_T("Toolbar"),
            this, IDM_VIEW_TOOLBAR,
            WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
            | CBRS_TOOLTIPS | CBRS_HIDE_INPLACE
            ) || !m_measToolBar.LoadToolBar(IDR_TOOLBAR)
        ) {
        TRACE0 ("Failed to create toolbar\n");
        return -1; // fail to create
    }

    // Status Control Bar
    if (!m_wndStatusBar.Create (this) ||
        !m_wndStatusBar.SetIndicators (indicators,
         sizeof (indicators)/sizeof (UINT)))    {
        TRACE0 ("Failed to create status bar\n");
        return -1; // fail to create
    }

    m_wndStatusBar.SetPaneInfo (1, ID_SEPARATOR, SBPS_NORMAL, 250);
    
    m_gtdGraphicBar.SetInitDesiredSizeVertical (CSize (200, 400));
    m_gtdGraphicBar.SetInitDesiredSizeHorizontal (CSize (400, 200));
    if (!m_gtdGraphicBar.Create (
            _T("Graphic"), // _T("Optional control bar caption"),
            this, IDM_VIEW_GRAPHICBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarEmpty\n");
        return -1;        // fail to create
    }

    m_histogramBar.SetInitDesiredSizeVertical (CSize ( 200, 400 ));
    m_histogramBar.SetInitDesiredSizeHorizontal (CSize ( 400, 200 ));
    if (!m_histogramBar.Create (
            _T("Histogram"), // _T("Optional control bar caption"),
            this, IDM_VIEW_HISTOGRAMBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarEmpty\n");
        return -1;        // fail to create
    }

    m_measureBar.SetInitDesiredSizeVertical (CSize (200, 400));
    m_measureBar.SetInitDesiredSizeHorizontal (CSize (400, 200));
    if (!m_measureBar.Create (
        _T("Measure"), // _T("Optional control bar caption"),
        this, IDM_VIEW_MEASUREBAR,
        WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
        |CBRS_TOOLTIPS
        |CBRS_FLYBY
        |CBRS_SIZE_DYNAMIC
        |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarEmpty\n");
        return -1;        // fail to create
    }

    m_infoBar.SetInitDesiredSizeVertical (CSize (200, 400));
    m_infoBar.SetInitDesiredSizeHorizontal (CSize(400, 200));
    if(    !m_infoBar.Create (
            _T("Info"), // _T("Optional control bar caption"),
            this, IDM_VIEW_INFOBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarEmpty\n");
        return -1;        // fail to create
    }

    m_coordinateBar.SetInitDesiredSizeVertical (CSize (100, 200));
    m_coordinateBar.SetInitDesiredSizeHorizontal (CSize (200, 100));
    if(!m_coordinateBar.Create (
            _T("Coordinate"), // _T("Optional control bar caption"),
            this, IDM_VIEW_COORDINATEBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarEmpty\n");
        return -1;        // fail to create
    }

    m_coordinate.Create (WS_CHILD|WS_VISIBLE, CRect (0, 0, 0, 0),
        &m_coordinateBar, m_coordinateBar.GetDlgCtrlID ());

    theApp.SetFont (m_coordinate, 25);
    m_coordinate.AddString (_T("X: "));
    m_coordinate.AddString (_T("Y: "));
    m_coordinate.AddString (_T("Z: "));

    m_nmrDBBar.SetInitDesiredSizeVertical (CSize (200, 400));
    m_nmrDBBar.SetInitDesiredSizeHorizontal(CSize (400, 200));
    if (!m_nmrDBBar.Create (
            _T("Nmr DB"), // _T("Optional control bar caption"),
            this, IDM_VIEW_NMRDBBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarTree\n");
        return -1;        // fail to create
    }
    if(!m_nmrDBTree.Create (
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
            |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
            |TVS_INFOTIP|TVS_DISABLEDRAGDROP
            |TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect(0,0,0,0),
            &m_nmrDBBar,
            m_nmrDBBar.GetDlgCtrlID ()
            )
        ) {
        TRACE0 ("Failed to create m_wndDockedCtrlEdit\n");
        return -1;        // fail to create
    }
    m_nmrDBTree.SetFont (CFont::FromHandle ((HFONT)::GetStockObject(DEFAULT_GUI_FONT)));

    m_pcsProbeBar.SetInitDesiredSizeVertical (CSize (200, 400));
    m_pcsProbeBar.SetInitDesiredSizeHorizontal (CSize(400, 200));
    if(    !m_pcsProbeBar.Create(
            _T("PCS/Probe"), // _T("Optional control bar caption"),
            this,
            IDM_VIEW_PCSPROBEBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarTree\n");
        return -1;        // fail to create
    }
    if (!m_pcsProbeTree.Create (
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
            |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
            |TVS_INFOTIP|TVS_DISABLEDRAGDROP
            |TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect (0, 0, 0, 0),
            &m_pcsProbeBar, m_pcsProbeBar.GetDlgCtrlID()
            )
        ) {
        TRACE0 ("Failed to create m_wndDockedCtrlEdit\n");
        return -1;        // fail to create
    }
    m_pcsProbeTree.SetFont(CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)));

    for (int nTreeIdx0 = 0; nTreeIdx0 < 10; nTreeIdx0++) {
        CString sTreeItemText;
        sTreeItemText.Format (_T("Item 1-%d"), nTreeIdx0+1);
        HTREEITEM htiAtLevel0 = m_pcsProbeTree.InsertItem (LPCTSTR(sTreeItemText));
        ASSERT(htiAtLevel0 != NULL);
        for (int nTreeIdx1=0; nTreeIdx1 < 5; nTreeIdx1++) {
            sTreeItemText.Format (_T("Item 2-%d"), nTreeIdx1+1);
            HTREEITEM htiAtLevel1 =    m_pcsProbeTree.InsertItem (LPCTSTR(sTreeItemText), htiAtLevel0);
            ASSERT (htiAtLevel1 != NULL);
            for (int nTreeIdx2=0; nTreeIdx2<3; nTreeIdx2++) {
                sTreeItemText.Format (_T("Item 3-%d"), nTreeIdx2+1);
                HTREEITEM htiAtLevel2 =    m_pcsProbeTree.InsertItem (LPCTSTR(sTreeItemText), htiAtLevel1);
                ASSERT (htiAtLevel2 != NULL);
                htiAtLevel2;
            }
        }
    }

    m_dmisBar.SetInitDesiredSizeVertical(CSize( 200, 400 ));
    m_dmisBar.SetInitDesiredSizeHorizontal(CSize( 400, 200 ));
    if (!m_dmisBar.Create (_T("Dmis"), // _T("Optional control bar caption"),
            this, IDM_VIEW_DMISBAR,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        ) {
        TRACE0 ("Failed to create m_wndResizableBarTree\n");
        return -1;        // fail to create
    }
    if (!m_dmisTree.Create (
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
            |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
            |TVS_INFOTIP|TVS_DISABLEDRAGDROP
            |TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect (0, 0, 0, 0),    &m_dmisBar, m_dmisBar.GetDlgCtrlID())
        ) {
        TRACE0 ("Failed to create m_wndDockedCtrlEdit\n");
        return -1;        // fail to create
    }
    m_dmisTree.SetFont (CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)));
    for (int nTreeIdx0 = 0; nTreeIdx0 < 10; nTreeIdx0++) {
        CString sTreeItemText;
        sTreeItemText.Format (_T("Item 1-%d"), nTreeIdx0+1);
        HTREEITEM htiAtLevel0 =    m_dmisTree.InsertItem (LPCTSTR(sTreeItemText));
        ASSERT (htiAtLevel0 != NULL);
        for (int nTreeIdx1 = 0; nTreeIdx1 < 5; nTreeIdx1++ ) {
            sTreeItemText.Format (_T("Item 2-%d"), nTreeIdx1+1);
            HTREEITEM htiAtLevel1 =    m_dmisTree.InsertItem (LPCTSTR(sTreeItemText), htiAtLevel0);
            ASSERT ( htiAtLevel1 != NULL );
            for (int nTreeIdx2 = 0; nTreeIdx2 < 3; nTreeIdx2++)    {
                sTreeItemText.Format (_T("Item 3-%d"), nTreeIdx2+1);
                HTREEITEM htiAtLevel2 =    m_dmisTree.InsertItem (LPCTSTR(sTreeItemText), htiAtLevel1);
                ASSERT( htiAtLevel2 != NULL );
                htiAtLevel2;
            }
        }
    }


    // TODO: Delete these lines if you don’t want the dockable entity
    //m_wndMenuBar.EnableDocking ( CBRS_ALIGN_ANY );    //20060802    leesangkyu 메뉴 도킹 해지
    m_wndToolBar.EnableDocking (CBRS_ALIGN_ANY);
    m_measToolBar.EnableDocking (CBRS_ALIGN_ANY);
    m_gtdGraphicBar.EnableDocking (CBRS_ALIGN_LEFT);
    m_histogramBar.EnableDocking (CBRS_ALIGN_LEFT);
    m_measureBar.EnableDocking (CBRS_ALIGN_LEFT);
    m_infoBar.EnableDocking (CBRS_ALIGN_RIGHT);
    m_coordinateBar.EnableDocking (CBRS_ALIGN_RIGHT);
    m_nmrDBBar.EnableDocking (CBRS_ALIGN_RIGHT);
    m_pcsProbeBar.EnableDocking (CBRS_ALIGN_RIGHT);
    m_dmisBar.EnableDocking (CBRS_ALIGN_RIGHT);

    if (!CExtControlBar::FrameEnableDocking(this)) {
        ASSERT (FALSE);
        return -1;
    }

    // Enable autohide feature for resizable control bars
    if (!CExtControlBar::FrameInjectAutoHideAreas(this)) {
        ASSERT (FALSE);
        return -1;
    }
    //DockControlBar( &m_wndMenuBar );    //20060802 leesangkyu 메뉴 도킹 해지
    DockControlBar (&m_wndToolBar);
    DockControlBar (&m_measToolBar);
    m_gtdGraphicBar.FloatControlBar (CPoint( 0, 0 ));
    m_histogramBar.FloatControlBar (CPoint( 0, 0 ));
    m_measureBar.FloatControlBar (CPoint( 0, 0 ));
    m_infoBar.FloatControlBar (CPoint( 0, 0 ));
    m_coordinateBar.FloatControlBar ( CPoint( 0, 0 ));

    m_nmrDBBar.DockControlBar (AFX_IDW_DOCKBAR_RIGHT, 1, this);
    m_pcsProbeBar.DockControlBar (AFX_IDW_DOCKBAR_RIGHT, 1, this);
    m_dmisBar.DockControlBar (AFX_IDW_DOCKBAR_RIGHT, 1, this);

    static UINT statBasicCommands[] =
    {
        ID_FILE_NEW,
    //(PROJTYPE_MDI || !NODOCVIEW)
        ID_FILE_OPEN,
        ID_FILE_SAVE,
    //!NODOCVIEW
        ID_APP_EXIT,
        ID_APP_ABOUT,
    // PRINT
    //    ID_FILE_PRINT,
    //    ID_FILE_PRINT_SETUP,
        ID_EDIT_COPY,
        ID_EDIT_CUT,
        ID_EDIT_PASTE,
        ID_EDIT_UNDO,
        ID_VIEW_TOOLBAR,
    //TOOLBAR
        IDM_VIEW_MENUBAR,
        IDM_VIEW_GRAPHICBAR,
        IDM_VIEW_HISTOGRAMBAR,
        IDM_VIEW_MEASUREBAR,
        IDM_VIEW_INFOBAR,
        IDM_VIEW_COORDINATEBAR,
        IDM_VIEW_NMRDBBAR,
        IDM_VIEW_PCSPROBEBAR,
        IDM_VIEW_DMISBAR,
    //(CRecordView || CDaoRecordView || COleDBRecordView)
    //HELP
        0 // end of commands list
    }; // statBasicCommands array

    //VERIFY (g_CmdManager->SetBasicCommands (__PROF_UIS_PROJECT_CMD_PROFILE_NAME, statBasicCommands));


    #if (!defined __EXT_MFC_NO_CUSTOMIZE)
    VERIFY(
        CExtCustomizeSite::MenuInfoAdd (
            this,
            _T("Default"),
            IDR_MAINFRAME,
            true
            )
        );
    VERIFY(
        CExtCustomizeSite::MenuInfoLoadAccelTable (
            _T("Default"),
            IDR_MAINFRAME
            )
        );

    if (!CExtCustomizeSite::EnableCustomization (
            this,
            __ECSF_DEFAULT//|__ECSF_PARMS_DISABLE_PERSONALIZED
            )
        )
    {
        ASSERT (FALSE);
        return -1;
    }

    _ConfigureCustomizeSite ();
    
    CExtCustomizeSite::CustomizeStateLoad (
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        pApp->m_pszProfileName
        );
    #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)


    // 저장된 UI 구조 정보 적용
    CExtControlBar::ProfileBarStateLoad (this, pApp->m_pszRegistryKey, pApp->m_pszProfileName,
        pApp->m_pszProfileName,    &m_dataFrameWP);

    g_CmdManager->SerializeState (__PROF_UIS_PROJECT_CMD_PROFILE_NAME, pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,    false);

    _ResetAllCommandTrees ();
    m_wndMenuBar.UpdateMenuBar ();
    RecalcLayout ();
    CExtControlBar::stat_RecalcBarMetrics (this);
    CExtControlBar::stat_RedrawFloatingFrames (this);
//    m_pWndView->PostMessage( WM_COMMAND, IDC_CHECK_ALLOW_CUSTOM_LANGUAGE );

    return 0;
}
===============================================================================================================

Technical Support Aug 25, 2006 - 6:57 AM

If you defined the AFX_IDS_IDLEMESSAGE item in the string tables of all supported languages in your project and translated this string then you should see it localized. We can check your project and find out what’s wrong.