wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
nourgaliev
Knows some wx things
Knows some wx things
Posts: 36
Joined: Thu Mar 02, 2023 12:42 pm

wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."

Post by nourgaliev »

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.
User avatar
doublemax
Moderator
Moderator
Posts: 18180
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."

Post by doublemax »

What did you pass as parent for the dialog?
Use the source, Luke!
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

Current window (this), I am calling from. It is wxFrame.
User avatar
doublemax
Moderator
Moderator
Posts: 18180
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."

Post by doublemax »

Please show the code for the event handler, and how you Bind it to the event.
Use the source, Luke!
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

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
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

Event is binded as:

this->Bind(wxEVT_BUTTON, &edit_nodes::on_help, this, wxID_HELP);
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

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.
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

Any problem with my derived class?
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

I think the problem is with my derived class. When I do directly - everything is fixed. My bad. Thanks!
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

I wanted to customize this class - but, apparently, you should not do that. Somehow - it screwed parent window...
User avatar
doublemax
Moderator
Moderator
Posts: 18180
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."

Post by doublemax »

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...
In principle this should work. And i can't spot any obvious bug in your code.
Use the source, Luke!
nourgaliev
Knows some wx things
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."

Post by nourgaliev »

doublemax wrote: Sun Mar 19, 2023 8:08 pm
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...
In principle this should work. And i can't spot any obvious bug in your code.
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.

Thanks.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 6737
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxRichMessageDialog: "GtkDialog mapped without a transient parent. This is discouraged."

Post by ONEEYEMAN »

Hi,
What you did want to change?

Thank you.
Post Reply