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

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
 
P

Peter Duniho

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
 
M

Mracka Michal

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
 
Z

Zytan

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
 
Z

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top