DoModal() Dialog Position
-
I have a dialog and this dialog's domodal function(myDlg->DoModal) is called from another cpp file. I got rectangle of this dialog at the end of the oninitdialog function and a button clicked event after the dialog had been visible but these two rectangle values were different. Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
other.cpp: myDlg->domodal() myDlg.cpp: myDlg::OnInitDialog { //other code ...... ...... GetWindowRect(&rect); // top=29 bottom=221 left=165 right=1033 //end of function } myDlg::ButtonClick //i clicked button while the dialog was on the screen { GetWindowRect(&rect); // top=431 bottom=623 left=407 right=1275 }
Why are these two rectangle diffenrent? Thanks. -
I have a dialog and this dialog's domodal function(myDlg->DoModal) is called from another cpp file. I got rectangle of this dialog at the end of the oninitdialog function and a button clicked event after the dialog had been visible but these two rectangle values were different. Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
other.cpp: myDlg->domodal() myDlg.cpp: myDlg::OnInitDialog { //other code ...... ...... GetWindowRect(&rect); // top=29 bottom=221 left=165 right=1033 //end of function } myDlg::ButtonClick //i clicked button while the dialog was on the screen { GetWindowRect(&rect); // top=431 bottom=623 left=407 right=1275 }
Why are these two rectangle diffenrent? Thanks.Did you move your dialog before clicking the button ? If yes, then it's normal that the rectangle changed.
Cédric Moonen Software developer
Charting control [v1.4] -
I have a dialog and this dialog's domodal function(myDlg->DoModal) is called from another cpp file. I got rectangle of this dialog at the end of the oninitdialog function and a button clicked event after the dialog had been visible but these two rectangle values were different. Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
other.cpp: myDlg->domodal() myDlg.cpp: myDlg::OnInitDialog { //other code ...... ...... GetWindowRect(&rect); // top=29 bottom=221 left=165 right=1033 //end of function } myDlg::ButtonClick //i clicked button while the dialog was on the screen { GetWindowRect(&rect); // top=431 bottom=623 left=407 right=1275 }
Why are these two rectangle diffenrent? Thanks.mehmetned wrote:
Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
There is a function called _
AfxPostInitDialog
which does some additional house keeping afterOnInitDialog
! From what I see it's centering the dialog!Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
I have a dialog and this dialog's domodal function(myDlg->DoModal) is called from another cpp file. I got rectangle of this dialog at the end of the oninitdialog function and a button clicked event after the dialog had been visible but these two rectangle values were different. Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
other.cpp: myDlg->domodal() myDlg.cpp: myDlg::OnInitDialog { //other code ...... ...... GetWindowRect(&rect); // top=29 bottom=221 left=165 right=1033 //end of function } myDlg::ButtonClick //i clicked button while the dialog was on the screen { GetWindowRect(&rect); // top=431 bottom=623 left=407 right=1275 }
Why are these two rectangle diffenrent? Thanks.