Hello,
I'm using wxWidgets version 3.1.0 on RHEL8 Linux.
// Output of uname -a
Linux Freeman 4.18.0-147.5.1.el8_1.x86_64 #1 SMP Tue Jan 14 15:50:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
After invoking a modal dialog, the X button in the upper right corner is visible but pressing it does nothing.
Windows works fine and call the OnClose event.
Any idea what is wrong or missing?
Thanks.
We have Cancel and Close event handlers.
BEGIN_EVENT_TABLE(itiManageGroupsDialog,itiBaseDialog)
EVT_BUTTON(wxID_OK,itiManageGroupsDialog::OnExecute)
EVT_BUTTON(wxID_CANCEL,itiManageGroupsDialog::OnCancel)
EVT_CLOSE(itiManageGroupsDialog::OnClose)
EVT_INIT_DIALOG(itiManageGroupsDialog::OnInit)
END_EVENT_TABLE()
void itiManageGroupsDialog::OnCancel(wxCommandEvent &event)
{
wxLogWarning("OnCancel") ;
EndModal(wxID_CANCEL) ;
event.Skip();
}
void itiManageGroupsDialog::OnClose(wxCloseEvent &event)
{
wxLogWarning("OnCancel") ;
EndModal(wxID_CANCEL) ;
event.Skip();
}
X button in upper right corner of modal dialog
Re: X button in upper right corner of modal dialog
Hi,
Couple of comments:
1. You should supply the "code" tags around the code you post on the forum. There is an appropriate button at the top of the text control.
2. You don't have to supply "event.Skip()" when you handle the wxCommandEvent. Those events are not system events, but rather user-defined.
And so this call doesn't do anything. You should, however, use it when handling the system-generated events (keyboard, mouse, focus).
3. Can you compile and run the dialogs sample and see if it has the same behavior you observe.
4. What version of GTK+ the program is compiled against?
Finally, it would be great if you can try with the Git master and see if this was a bug that already been fixed.
Thank you.
Couple of comments:
1. You should supply the "code" tags around the code you post on the forum. There is an appropriate button at the top of the text control.
2. You don't have to supply "event.Skip()" when you handle the wxCommandEvent. Those events are not system events, but rather user-defined.
And so this call doesn't do anything. You should, however, use it when handling the system-generated events (keyboard, mouse, focus).
3. Can you compile and run the dialogs sample and see if it has the same behavior you observe.
4. What version of GTK+ the program is compiled against?
Finally, it would be great if you can try with the Git master and see if this was a bug that already been fixed.
Thank you.
Re: X button in upper right corner of modal dialog
Hi,
On debian buster, in a gtk+3 wx3.1.1 build (and also in git head), the 'modeless' dialog (Ctrl-Sh-Z) of the 'dialogs' sample successfully catches wxID_CLOSE. So you can merge your code into that until something breaks.
Regards,
David
On debian buster, in a gtk+3 wx3.1.1 build (and also in git head), the 'modeless' dialog (Ctrl-Sh-Z) of the 'dialogs' sample successfully catches wxID_CLOSE. So you can merge your code into that until something breaks.
Regards,
David
Re: X button in upper right corner of modal dialog
David,
I think the OP is asking about the MODAL dialog.
Thank you.
I think the OP is asking about the MODAL dialog.
Thank you.
Re: X button in upper right corner of modal dialog
Yes, but it's the modeless dialog in that sample that catches wxID_CLOSE.I think the OP is asking about the MODAL dialog.
Re: X button in upper right corner of modal dialog
Not really sure how to determine the GTK+ version.
Tried this: rpm -qa | grep -i gtk
Came back with this: gtk2-2.24.32-4.el8.x86_64
-----
Yes, the X button in our Modeless dialogs work.
Tried this: rpm -qa | grep -i gtk
Came back with this: gtk2-2.24.32-4.el8.x86_64
-----
Yes, the X button in our Modeless dialogs work.
Re: X button in upper right corner of modal dialog
Doing Ctrl-Alt-Middleclick over any wx program will show a dialog that shows the wx and (for linux) gtk version.Not really sure how to determine the GTK+ version.
Here's a quick-and-very-dirty diff to the dialogs sample that turns the modeless dialog modal. For me, it still catches the 'X' click, both in gtk2 and gtk3 builds.
Re: X button in upper right corner of modal dialog
From the diff, it looks like your just replacing ShowModal with Show but we really don't want to do this.
I didn't see anything on GitHub that helped. There were references to wxID_CLOSE but none of the cases referenced this issue
that I could find.
Thanks.
I didn't see anything on GitHub that helped. There were references to wxID_CLOSE but none of the cases referenced this issue
that I could find.
Thanks.
Re: X button in upper right corner of modal dialog
No, vice versa:
Code: Select all
- m_dialog->Show(true);
+ m_dialog->ShowModal();