Discussion:
Is it possible to cancel button defaultness
Igor Korot
2014-05-28 00:00:32 UTC
Permalink
Hi, ALL,
Would it be possible to cancel a default behavior of the button?

In my situation I want the button to be "default" one (react to Enter
key) only on some conditions.

Thank you.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Steve Barnes
2014-05-28 05:34:08 UTC
Permalink
Post by Igor Korot
Hi, ALL,
Would it be possible to cancel a default behavior of the button?
In my situation I want the button to be "default" one (react to Enter
key) only on some conditions.
Thank you.
Yes - either in your handler for the controls that form part of your
condition you should be able to update the default or for your whole
dialogue set up an on enter handler that checks your conditions and then
calls the appropriate method as if that button was clicked.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Steve Cookson
2014-05-28 07:14:16 UTC
Permalink
Post by Steve Barnes
Yes - either in your handler for the controls that form part of your
condition you should be able to update the default or for your whole
dialogue set up an on enter handler that checks your conditions and
then calls the appropriate method as if that button was clicked.
Well, I think you can change the default to another button but I don't
think you can do ->SetDefault(0), which is what the questioner implies.

Regards

Steve.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Steve Barnes
2014-05-28 18:48:58 UTC
Permalink
Post by Steve Cookson
Post by Steve Barnes
Yes - either in your handler for the controls that form part of your
condition you should be able to update the default or for your whole
dialogue set up an on enter handler that checks your conditions and
then calls the appropriate method as if that button was clicked.
Well, I think you can change the default to another button but I don't
think you can do ->SetDefault(0), which is what the questioner implies.
Regards
Steve.
Steve,

But you can disable TheButton->Enable(0) when the conditions are not met
and ->Enable(1) when they are not in the first scenario or show an
appropriate error message in the second then cancel/ignore the event.

Re-reading the question either would have the same effect as it sounds
like the questioner desires.

Gadget/Steve
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...