Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Child Dialog - please help!

Status
Not open for further replies.

Lorey

Programmer
Feb 16, 2003
88
0
0
SG
Hi experts!

I always call below function in my program. Is it right to always NEW and DELETE it? Also, when I close my child dialog by pressing OK button, my parent dialog doesnt refresh, meaning, my child dialog closes but it leaves a gray shadow in my parent dialog. One more thing, how can i show the dialog in always center of my parent dialog no matter what position my parent dialog is displayed.


void parentDialog::sessionInitialisation()
{
childdialog = new TA_IRS_App::CRadioSessionDialog(this);
childdialog ->Create(IDD_SESSION_DIALOG,this);
childdialog ->ShowWindow(SW_SHOW);
childdialog ->sessionInitialising();

childdialog ->setMovingbar(); ---> acts like domodal until user press ok button

delete childdialog ; --> is this necessary?
childdialog = NULL;
}
 
you should always call delete on something you have created with new.. unless youre using smart pointers.. and i must admit, i dont know much about those.

you may want to force an Invalidate() or a ValidateRect(), if youre using windows code. this should force a paint before the next WM_PAINT is called.



for centering the dialog, you could always grab the screen Rect

something like GetClientRect() and divide by two to find the middle of the screen and adjust to fit it in the center.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top