I've created a Modaless dialog inside a dialog A which displays some content. I've overridden ONClose() event of Modalless dialog and hidden the modaless dialog inside it and sends the message to dialog A to load the content again. Now the problem is whenever I've launched the modaless dialog and moved that dialog inside the main dialog and then closed the dialog. The portion of the dialog displayed inside the dialog A is not re-painted.
In Debugging I found that Dialog A is actually painted after modaless dialog got closed in the client area of Dialog A and then after the On Close Event done in Modaless dialog, the portion of the modaless dialog which has painted is lost and that portion is background as white( I've handled EraseBackgroung to white).
Any suggestion would be helpful.
Thanks
Related
On Windows, when a window opens on top of another window, the parent window will not be clickable, and will make a "ding" sound and its titlebar will flash. It will do this until the other window is closed. How do I recreate this in Win32?
The words you are looking for are modal and modeless.
Modal dialogs won't let the user interact with the parent window until they've been dismissed.
This document covers the Win32 API for creating modal dialogs.
Environment: MFC frame based SDI application
Problem: After closing modal dialog boxes, the bitmap stays displayed/the window beneath doesn't repaint.
Dialog creation:
PortSettings Dlg;
Dlg.DoModal();
I've tried explicitly setting OnCancel() for the dialog class,
void PortSettings::OnCancel()
{CDialog::OnCancel();}
tried calling RedrawWindow from the parent window and the Dialog OnCancel.
This issue happens for all the dialog boxes, and other modal windows that open (Like a file browser) I assume because I am using MFC I've somehow interfered with the underlying Window Proc but I'm not sure how to investigate or what to try.
Solution was multifaceted:
Dialog Window Properties affect the image lingering - in my case, it was necessary to change the dialog frame to "thin" style.
After the Dlg.DoModal() call, call ParentWnd->RedrawWindow(). In the Parent Window's OnPaint, I added a fillSolidRect to repaint the background white. This section is controlled with Boolean logic to only repaint immediately after a dialog closes to avoid flickering.
The question is for GTK+ programing in C++.
I have a main window with a button that activates a dialog window. The dialog window has OK and CANCEL buttons. I did it that way so when I hit the cancel button the dialog is closed. But once it is closed I cannot call it again with the button in the main window.
I have tried to call the dialog delete-event on the button click. I also tried to call the dialog destroy event when the button is clicked. But in both cases the dialog is destroyed and it does not show when I click the button that calls the dialog.
I suppose this is a follow up of your other question on the topic:
How to properly close a dialog made in Glade?
If it was created using GtkBuilder, if you destroy the window, it's really destroyed: GtkBuilder has created the widgets at parsing time, not when you call get_object, and won't create them again. So I think you should just hide the dialog with something like gtk_widget_hide_on_delete, and show it again when you click on the button in your main dialog.
How to handle messages of sub window in MFC.
I created a menu and when I'm clicking the menu, the program creates a dialog window.
How do I close the menu window when its dialog window is closed?
If dialog is modal:
Close the parent window after returning from DoModal;
You don't return from DoModal until the dialog is closed.
If dialog is not modal:
When you initialize the dialog, send a pointer of the parent to the dialog.
Close the parent using the pointer, where you capture the dialog close event.
I have created a window which has a toolbar with some icons, and I launch one more window clicking on the available icon from the main window.
First window is created using CreateWindowEx method.
the one I click using an icon is created using dialog resource.
So without closing dialog, I directly close the main window. I see that dialog window is not getting closed.
When I debug, control does not come to destructor of second window.
When I close them individually (i.e dialog first) and then main window next,then everything is fine.
Please help,that what might be missing when I close the main window.
I mean class desctructor is not getting called.
Handle your main window's message WM_CLOSE and check, whether the dialog window is open or not. If dialog window is open, just close it using the handle you got returned while loading it from resources.