how to select a button control programmatically?

R

Ross Brown

I have a form that contains a repeating section, inside which are some
buttons. Clicking one button is supposed to invoke some form code and then
move the selection to another button. InfoPath's SelectNodes/SelectText
methods don't help, of course, because these buttons are not bound to XML
nodes. So, short of messing with SendKeys, how does one do the programmatic
equivalent of tabbing between controls or simply moving the selection to a
control?
 
R

Ross Brown

[Clarification would be good: I'm referring to putting the HIGHLIGHT
(marquee dots) on the button control, thus inviting the user to press Enter
to "click" it, not a SELECTION such as you'd get by dragging across the
button in HTML.]
 
A

Andrew Watt [MVP - InfoPath]

I have a form that contains a repeating section, inside which are some
buttons. Clicking one button is supposed to invoke some form code and then
move the selection to another button. InfoPath's SelectNodes/SelectText
methods don't help, of course, because these buttons are not bound to XML
nodes. So, short of messing with SendKeys, how does one do the programmatic
equivalent of tabbing between controls or simply moving the selection to a
control?

Ross,

My gut feeling is that using buttons inside repeating sections to move
around probably shouldn't be your first choice way to go.

Can you explain the business problem you are trying to solve? In other
words what the user sees/wants to do rather than how you have chosen
to solve it.

Thanks.

Andrew Watt
MVP - InfoPath
 
R

Ross Brown

Andrew Watt said:
Ross,

My gut feeling is that using buttons inside repeating sections to move
around probably shouldn't be your first choice way to go.

Can you explain the business problem you are trying to solve? In other
words what the user sees/wants to do rather than how you have chosen
to solve it.

The display consists of a repeating table of entries with each item having a
+/- iconic button control to expand or collapse its detail. The entire form
is read-only, so if the user wants to enter data relative to one item in the
table, there is a "pen" iconic button to express that will, opening a second
form where the data is entered.

Another way to do it, more in the InfoPath Way of Doing Things, would be to
have the user select the item in the repeating table, then have the data
entry fields appear in a corresponding detail control or an HTML task pane.
The former would violate the read-only nature of the main form, and the
latter would deny InfoPath's XML-handling capabilities to the logic that
handles data entry. Hence the two-form approach, and the buttons are a quick
way to jump into the proper value-entry context.

This all works nicely except for the focus/highlight handling. Because
button controls are not "first-class entities" in the InfoPath object model,
there seems to be no good way to manage this. Specifically, the problem is
that when the user clicks the +/- control, causing other elements to appear
or disappear, the focus moves off the control, and I can't reliably re-focus
it.

Thanks for the help,
Ross Brown
 

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