Re: multiple language support: dialog-boxes
On 19 Jun., 16:20, Joseph M. Newcomer <newco...@flounder.com> wrote:
On Sat, 19 Jun 2010 04:56:30 -0700 (PDT), mfc <mfcp...@googlemail.com> wr=
The whole application is a sdi application with the doc/view modell;
therefore I`m loading a dialog at the startup with e.g. buttons etc.
// TODO: add construction code here
IDD is the id from the dialog box, generated by the resoure editor.
I`ve copied this dialog box to the other projects (satellite dlls for
German and for English); Maybe this approach is wrong....
No, it looks fine. Key here is that you have to switch languages in th=
In the end, when the programm is started, the user should see a sdi
window app where he can switch to different languages by some
cbuttons. There will be no menu in the end application.
Switching the resource which is the SDI CFormView is much harder. What=
you have to do is
create a new CFormView using the new dialog template, attach it to the do=
destroy the original CFormView. Note that you should use UpdateAllView=
s with a nonzero
lHint to tell any existing view to store its control contents in the docu=
ment, and upon
completion, use UpdateAllViews with a different nonzero lHint to tell the=
form to retrieve
any existing data from the document and put it into the current view. =
Otherwise, if you
switch views with information in the controls, the information would be l=
See the MSDN example on how to switch views of an SDI app.
That means every dialog box (having the same content but for a
different language) has its own id (id for the main-dialog in English !
= id for the main-dialog in German)? Moreover you will need a
different CFormView-Class for every language and for every dialogbox?
Ok it doesn`t matter how many classes a project will include...
All the stuff to change the view is correct placed in the mainframe
pOldView = GetActiveView();
// load the specific view to be the current view (only a demo-example
with one view)
pNewViewRTClass = RUNTIME_CLASS(CMLSampleView);
if(m_pCFirstView == NULL)
m_pCFirstView = STATIC_DOWNCAST(CView, pNewViewRTClass-
m_pNewView = m_pCFirstView;
int nChildId = m_pNewView->GetDlgCtrlID();
CDocument *pDoc = pOldView->GetDocument();
pDoc->m_bAutoDelete = FALSE;
Or is it better to Destroy the old window?
pDoc->UpdateAllViews(NULL); will only call the active view in a sdi
application where only one view could be availabe at the same time....
But all the stuff (information in the controls; e.g. checkbox is
checked or not) have to be stored and loaded to the new view.... where
is the best place to do this step by step in the above code?