[Gtk-sharp-list] MessageBox cannot handle text with < or >

Bertrand Lorentz bertrand.lorentz at gmail.com
Sun May 18 09:36:07 UTC 2014


Hi,

On Sun, May 18, 2014 at 7:41 AM, MarLOne <InfoSeeker002 at gmail.com> wrote:
> Hi all,
>
> The problem is not just confined to < > but also '&' which needs to be
> replaced by &.
>
> You cannot display these string:
> "You can't display string with <hello>"
> "You can't display string with &."
>
> It seems the code behind the Gtk.MessageDialog() expects that the string to
> be displayed is a well-formed XML (or XHTML) string.

The shorter Gtk.MessageDialog constructor use the native function
gtk_message_dialog_new_with_markup, which expects the string to be
Pango markup:
https://developer.gnome.org/pygtk/stable/pango-markup-language.html

If you don't want that, you can use the other constructor that has an
additional use_markup bool:
http://docs.go-mono.com/?link=C%3aGtk.MessageDialog.MessageDialog(Gtk.Window%2cGtk.DialogFlags%2cGtk.MessageType%2cGtk.ButtonsType%2cbool%2cstring%2cobject%5b%5d)

--
Bertrand


More information about the Gtk-sharp-list mailing list