wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
I am using wxRichMessageDialog to manage my messages. Works like a charm on Mac. On Linux, using gtk2/3, I am getting very annoying messages, something like:
wxWidgets/wxWidgets/src/gtk/toplevel.cpp(1257): assert ""m_widget"" failed in DoSetSize(): invalid frame
Gtk-Message: 13:21:27.524: GtkDialog mapped without a transient parent. This is discouraged.
And it pops window. I could shut down this for a particular run, but this is not acceptable long term solution.
Any suggestion to handle this? This is apparently warning, it not necessary crashes the code, but not really nice... My suspicion that parent window somehow was not passed to gtk, and will freak out.
Thanks in advance!
Robert.
wxWidgets/wxWidgets/src/gtk/toplevel.cpp(1257): assert ""m_widget"" failed in DoSetSize(): invalid frame
Gtk-Message: 13:21:27.524: GtkDialog mapped without a transient parent. This is discouraged.
And it pops window. I could shut down this for a particular run, but this is not acceptable long term solution.
Any suggestion to handle this? This is apparently warning, it not necessary crashes the code, but not really nice... My suspicion that parent window somehow was not passed to gtk, and will freak out.
Thanks in advance!
Robert.
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
What did you pass as parent for the dialog?
Use the source, Luke!
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
Current window (this), I am calling from. It is wxFrame.
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
Please show the code for the event handler, and how you Bind it to the event.
Use the source, Luke!
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
Code: Select all
//********************************************************************************
///
/// "Help" event handler
///
/// @author Robert Nourgaliev
///
//********************************************************************************
void edit_nodes::on_help(wxCommandEvent & WXUNUSED(event))
{
UTILS::GUI::message_dialog dialog(m_conf_tag+wxString("on_help_"),
m_configuration,
this,
wxT("You can add/delete block nodes, or directly edit the list"),
wxT("Edit the list of block nodes"),
wxOK | wxICON_INFORMATION);
if (dialog.show_modal()==wxID_OK) {
}
return;
} // edit_nodes::on_help()
UTILS::GUI::message_dialog is derived from wxRichMessageDialog:
namespace UTILS {
namespace GUI {
///
/// @brief Customized class for message dialog, in GUI of TELOS
/// @author Robert Nourgaliev
/// @copyright \mycopyright
/// @date March 17, 2023
///
class message_dialog : public wxRichMessageDialog
{
public:
///
/// Show dialog in modal mode
///
int show_modal();
///
/// Constructor
///
message_dialog(wxString const & tag, ///< [in] Short identification tag for storage in configuration file
wxFileConfig * configuration, ///< [in] Pointer to configuration file
wxWindow * parent, ///< [in] Parent window
wxString const & message, ///< [in] Messgae
wxString const & caption = wxMessageBoxCaptionStr, ///< [in] Caption
long style = wxOK|wxCENTRE ///< [in] Stype
);
///
/// Destructor
///
virtual
~message_dialog();
protected:
wxString m_conf_tag; ///< Short identification tag for storage in configuration file
///
/// Pointer to configuration file
///
wxFileConfig * m_configuration { nullptr };
}; // end of message_dialog class
} // end of "namespace GUI"
} // end of "namespace UTILS"
and
//********************************************************************************
///
/// Constructor
///
/// @author Robert Nourgaliev
///
//********************************************************************************
message_dialog::message_dialog(wxString const & tag,
wxFileConfig * configuration,
wxWindow * parent,
wxString const & message,
wxString const & caption,
long style)
: wxRichMessageDialog(parent, message, caption, style),
m_conf_tag(tag),
m_configuration(configuration)
{} // message_dialog::message_dialog()
//********************************************************************************
///
/// Destructor
///
/// @author Robert Nourgaliev
///
//********************************************************************************
message_dialog::~message_dialog()
{
store_position_size();
} // top_level_frame::~top_level_frame()
//********************************************************************************
///
/// Show dialog in modal mode
///
/// @author Robert Nourgaliev
///
//********************************************************************************
int message_dialog::show_modal()
{
return ShowModal();
} // message_dialog::show_modal()
Last edited by doublemax on Sun Mar 19, 2023 7:57 pm, edited 1 time in total.
Reason: added code tags
Reason: added code tags
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
Event is binded as:
this->Bind(wxEVT_BUTTON, &edit_nodes::on_help, this, wxID_HELP);
this->Bind(wxEVT_BUTTON, &edit_nodes::on_help, this, wxID_HELP);
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
It works fine on Mac. On gtk - pops windows with error, but when I choose continue - it goes further fine. If I choose do not show this message again - no windows pop up anymore for the rest of the code running.
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
Any problem with my derived class?
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
I think the problem is with my derived class. When I do directly - everything is fixed. My bad. Thanks!
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
I wanted to customize this class - but, apparently, you should not do that. Somehow - it screwed parent window...
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
In principle this should work. And i can't spot any obvious bug in your code.nourgaliev wrote: ↑Sun Mar 19, 2023 8:02 pm I wanted to customize this class - but, apparently, you should not do that. Somehow - it screwed parent window...
Use the source, Luke!
-
- Knows some wx things
- Posts: 36
- Joined: Thu Mar 02, 2023 12:42 pm
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
I know - this is why I did not even tried without derived. It was not on my "to check list". In any case - I abandoned idea of customizing, in any case - as something I wanted to change - did not work anyway.doublemax wrote: ↑Sun Mar 19, 2023 8:08 pmIn principle this should work. And i can't spot any obvious bug in your code.nourgaliev wrote: ↑Sun Mar 19, 2023 8:02 pm I wanted to customize this class - but, apparently, you should not do that. Somehow - it screwed parent window...
Thanks.
Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."
Hi,
What you did want to change?
Thank you.
What you did want to change?
Thank you.