StdDialogButtonSizer default button


#1

Hi all,

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

Any hints would be appreciated.

regards.

bio.


#2

Fabio P. 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


#3

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