Changing the Caption of a Modal Dialog at Runtime 
Author Message
 Changing the Caption of a Modal Dialog at Runtime

Hi,
Does anyone know of a way to change the caption (title) and change static
text within a modal dialog box at runtime? I'm using MFC 4.2 / Visual
C++5.0.

I have been able to successfully to successfully change static text in a
MODELESS dialog box by displaying the dialog, then calling SetDlgItemText()
for that dialog.  (I think) the problem is that the DoModal function doesn't
return until OK or Cancel is pressed by the user to close the dialog.  By
this time, it's too late to change the text because the window is gone.

To summarize, I have 2 questions:
1. How do I change any sort of static text in a modal dialog at runtime?
2. What is the ID or variable name of the dialog box title that I want to
change?

Thank you very much,

Mike



Sat, 07 Oct 2000 03:00:00 GMT  
 Changing the Caption of a Modal Dialog at Runtime

Why don't U change it when U are in the dialog, i.e, OnInitDialog()???
if U want to change the data of a static text, U can declare a member variable
of CString type for that control and set it before U call the DoModal function.
But if U know the values inside the Dialog, then U can put it in the
OnInitDialog instead of using the DDX mechanism to do it for U.

There is no separate ID for the DlgBoxItem caption. So if U called SetWindowText
for the dialogbox, it should set the caption of the dialog box.

Quote:

> Hi,
> Does anyone know of a way to change the caption (title) and change static
> text within a modal dialog box at runtime? I'm using MFC 4.2 / Visual
> C++5.0.

> I have been able to successfully to successfully change static text in a
> MODELESS dialog box by displaying the dialog, then calling SetDlgItemText()
> for that dialog.  (I think) the problem is that the DoModal function doesn't
> return until OK or Cancel is pressed by the user to close the dialog.  By
> this time, it's too late to change the text because the window is gone.

> To summarize, I have 2 questions:
> 1. How do I change any sort of static text in a modal dialog at runtime?
> 2. What is the ID or variable name of the dialog box title that I want to
> change?

> Thank you very much,

> Mike



Sat, 07 Oct 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to change on runtime the caption of a C++ dialog app main window

2. How to change on runtime the caption of a C++ dialog app main window

3. Changing a Dialog's CAPTION during runtime

4. Change Caption in Modal DialogBox at run time ??

5. Changing Caption of CPropertyPage at runtime?

6. Change popup menu captions at runtime (ModifyMenu)

7. Change caption of childwindow runtime ?

8. Changing Floating Toolbar Caption Runtime...

9. How to change the caption of a MDI frame at runtime

10. Change a Modalless dialog to a Modal dialog

11. modal dialogs on top of modal dialogs...

12. Showing a modal dialog in a modal dialog application

 

 
Powered by phpBB® Forum Software