Rich Text Box Event Help

B

Bill Burke

I would like to have a rich text box with default text that becomes selected
when the user enters the field.

Is this possible?

Thanks
 
S

Scott L. Heim [MSFT]

Hi Bill,

As InfoPath is completely data driven you do not have programmatic access
to the controls on your View. As such, there is not, as an example, an
"OnFocus" event that will fire as you select a control.

Now with that said, there is a way to select text in specific controls so
if you wanted to allow your users to, say, click a button and set focus to
your Rich Text box, this could be done. (Another option may be where a user
makes a selection from a drop-down list box and then your code would move
the focus to the Rich Text box.)

Here is sample VBScript code that will set focus to a Rich Text control on
my form named field1:

Dim objRichTextBox
Set objRichTextBox =
XDocument.DOM.selectSingleNode("//my:myFields/my:field1")
XDocument.View.SelectText objRichTextBox

I hope this helps!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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