Hi all,
sorry for this question however i have a basic MFC app, i have a dialog box which i enter data in, the box saves the info and when i go back its all there and i can serialize it fine however when i close the dialog box i want the view to redraw, i've tried using
Invalidate(TRUE);
UpdateWindow();
however the information i have just added into the dialog is not displayed on screen.
can anyone help me, i've added the above call into the dialog onBnClickOk
thanks for your help,
Martin (Noobie) :)

Redrawing View
LewisBraid
1. The warning C4244 is because you assigned the outcome of DoModal to an int and /Wp64 is assigned. In a 64bit environment the return value is 64bit nut int is always 32bits. Either remove /Wp64 or use INT_PTR as a type for nRetInit or write
if (InitSetup.DoModal()==IDOK)
{
...
}
It's not wise to use 1 instead of IDOK.
2. Invalidate and UpdateWindow are no members of the document. In a Document you should use UpdateAllViews(NULL); This should update the View.
My tip for you: Read a book about MFC programming!
Alvaro de la Torre
And what is inside ConfigureApp.m_strIPRangeFrom
Set a breakpint and check it contents!
Also it seams tsrange to me that you have absolute coordinates to show the data! If your view is to small you see nothing.
JC-VEN
You have to invalidate the view and not the display of the dialog.
In the view you are calling the dialog with a DoModal call. Check if the result is IDOK if so invalidate the view.
Or from were do you call/launch the dialog
Oz.Net
Hi Martin,
this is the code i have used
void
CFYPV15Doc::OnSetup(){
// TODO: Add your command handler code hereINT_PTR nRetInit = ConfigureApp.DoModal();
if (nRetInit == IDOK){
UpdateAllViews(NULL);
}
}
in the ondraw function i am using this
pDC->TextOut(50, 432, pDoc->ConfigureApp.m_strIPRangeFrom);
however nothing is being displayed in the view.
thanks for your tip i have ordered a MFC book :)
sorry to both you with these questions.
Martin :)
Riggs16784
Hi Martin,
I launch the dialog from the Doc class, is this the correct thing to do, i tried putting this into the launch of the dialog:
int nRetInit = InitSetup.DoModal();
if(nRetInit == 1)
{
Invalidate(TRUE);
UpdateWindow();
}
but i get these errors:
warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
error C3861: 'Invalidate': identifier not found, even with argument-dependent lookup
error C2660: 'UpdateWindow' : function does not take 0 arguments
i'm not sure what to do at this point
thank you for your help
Martin :)
Greg D
Hi Martin,
thanks for all your help, it is now working and redrawing the views, i added
SetModifiedFlag(TRUE);
just prior to the UpdateAllViews and it seems to be working fine now.
thank you for all your help with this
Kindest regards
Martin :)
rafik el kheer
The location is fine as i have other stuff marked absolute which is visable, o for now i know that it should be showing up its just not :(
the info within the m_strIPRangeFrom i believe is there as i am able to serialize this information and it is stored within the saved file when opening with notepad or loading it back into the doc.
thanks for your help so far :)