Discussion:
[Gtk-sharp-list] gtk message dialog yes/no set focus button yes monodevelop
salvadorRenato
2017-01-30 19:56:19 UTC
Permalink
hi,

I am creating a messagedialog with button type yesNo
But it starts as the button in the selected, I would like to put the button
yes set focus default.

How can this be done?

Example code

MessageDialog md1 = new MessageDialog (null, DialogFlags.Modal,
MessageType.Info, ButtonsType.YesNo,"Registrar Item? ");

ResponseType response = (ResponseType)md1.Run ();

md1.Show ();

if (response == ResponseType.No) {
md1.Destroy ();
else
......




--
View this message in context: http://mono.1490590.n4.nabble.com/gtk-message-dialog-yes-no-set-focus-button-yes-monodevelop-tp4669869.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
_______________________________________________
Gtk-sharp-list maillist - Gtk-sharp-***@lists.dot.net
http://lists.do
Baltasar García Perez-Schofield
2017-01-31 09:10:04 UTC
Permalink
Hi,

If you want to have the dialog with the button "yes" set by default, then
add the line:
md1.DefaultResponse = Gtk.ResponseType.Yes;

Before the md1.Run() line. Also, remove the md1.Show() line, you don't need
that.

-- Baltasar
Post by salvadorRenato
hi,
I am creating a messagedialog with button type yesNo
But it starts as the button in the selected, I would like to put the button
yes set focus default.
How can this be done?
Example code
MessageDialog md1 = new MessageDialog (null, DialogFlags.Modal,
MessageType.Info, ButtonsType.YesNo,"Registrar Item? ");
ResponseType response = (ResponseType)md1.Run ();
md1.Show ();
if (response == ResponseType.No) {
md1.Destroy ();
else
......
--
http://mono.1490590.n4.nabble.com/gtk-message-dialog-yes-no-set-focus-button-yes-monodevelop-tp4669869.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
_______________________________________________
http://lists.dot.net/mailman/listinfo/gtk-sharp-list
salvadorRenato
2017-01-31 11:00:28 UTC
Permalink
Thanks a lot for the help.



--
View this message in context: http://mono.1490590.n4.nabble.com/gtk-message-dialog-yes-no-set-focus-button-yes-monodevelop-tp4669869p4669875.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
_______________________________________________
Gtk-sharp-list maillist - Gtk-sharp-***@lists.dot.

Loading...