Forum: wxRuby StdDialogButtonSizer default button

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89f9acdcbc663e41e45ce590cd746d6e?d=identicon&s=25 Fabio Petrucci (Guest)
on 2008-10-06 14:23
(Received via mailing list)
Hi all,

How do i set the default button for a Wx::StdDialogButtonSizer?

Any hints would be appreciated.

regards.

bio.
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2008-10-06 14:46
(Received via mailing list)
Fabio Petrucci wrote:
> How do i set the default button for a Wx::StdDialogButtonSizer?
>
> Any hints would be appreciated.

Wx::Button#set_default() I think does what you want, but I haven't
tested it.

If you need to retrieve the Button object from the ButtonSizer to call
this, you could use something like

dialog.find_window(Wx::ID_OK)

(in this case, to make 'OK' the default selection)

alex
89f9acdcbc663e41e45ce590cd746d6e?d=identicon&s=25 Fabio Petrucci (Guest)
on 2008-10-06 18:24
(Received via mailing list)
> Wx::Button#set_default() I think does what you want, but I haven't tested
> it.


It works.


>
> If you need to retrieve the Button object from the ButtonSizer to call
> this, you could use something like
>
> dialog.find_window(Wx::ID_OK)
>
> (in this case, to make 'OK' the default selection)
>
>
Just to let you know:
it doesn't works for me, i get this error:
undefined method 'find_window' for
#<Views::Dialog::LoginDialog:0xc9e30d4>

LoginDialog is a subclass of Wx::Dialog

I've got it using xrcresource combinations methods:

Wx::Window.find_window_by_id(Wx::xrcid('wxID_OK'), parent)

Thank you.

bio
This topic is locked and can not be replied to.