Snippet. Vala. Showing HTML Markup in Message Dialog

This Vala snippet shows how to insert HTML tags in a MessageDialog.

Text messages in MessageDialog can be formatted using a subset of HTML.

var dialog = new Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.INFO, Gtk.ButtonsType.OK, "Hello from Vala!");
dialog.set_title("Message Dialog");
dialog.set_markup("Hello from\r\nVala");
dialog.run();
dialog.destroy();

Updated on: 27 Dec 2024