multiple default buttons in a form, one per group control, possible?

  • Thread starter Thread starter Zytan
  • Start date Start date
Z

Zytan

Is it possible (I doubt it) to have multiple default buttons in a
form? I have several group controls in a single form, and when the
focus is within one of the group controls, I want a specific button to
be the default button.

For this to work, the default button would have to be set in each
individual group control, since the main form only has one value for
AcceptButton.

I doubt this is possible, since it likely breaks standard UI
functionality, that is, when you press ENTER in a TextBox, the OK
button is pressed, no matter where you are in the form.

Zytan
 
Is it possible (I doubt it) to have multiple default buttons in a
form? I have several group controls in a single form, and when the
focus is within one of the group controls, I want a specific button to
be the default button.
[...]

Windows (and so .NET) doesn't provide for this inherently. But you could
always implement it yourself by handling the Return/Enter keys and mapping
that to a default button depending on which control group has the focus.

Pete
 
Zytan said:
Is it possible (I doubt it) to have multiple default buttons in a
form? I have several group controls in a single form, and when the
focus is within one of the group controls, I want a specific button to
be the default button.

You can attach handlers to Enter events on the group controls.
In the handler simply change the default button.
(The DefaultButton proprerty is read/write enabled)

Mike
 
Windows (and so .NET) doesn't provide for this inherently.

Thought so.
But you could
always implement it yourself by handling the Return/Enter keys and mapping
that to a default button depending on which control group has the focus.

Yup, I knew that, I just wanted to know if there was a natural way to
do it, and I didn't think so.

Thanks

Zytan
 
You can attach handlers to Enter events on the group controls.
In the handler simply change the default button.
(The DefaultButton proprerty is read/write enabled)

Ok, thanks, Mike

Zytan
 
Back
Top