set focus to textbox that hides/unhides

C

chloraphil

I currently have a textbox that is hidden unless "Other" is selected from a
listbox. This functionality is implemented in Conditional Formatting.

I want to set focus to this textbox. SelectText doesn't work b/c the code
runs before the rules, therefore SelectText fails b/c the textbox isn't
user-selectable.

Ideas?
 
C

chloraphil

Here's my code, which is a bit of a hack, but works: (my apologies if it's
not very readable - it reads well in my VS IDE

public void OnContextChange(DocContextChangeEvent e)
{
if (e.Type == "ContextNode")
{
if (e.Context.nodeName.ToString().Equals("my:CI") && //correct context?

(thisXDocument.DOM.selectSingleNode("my:CI/my:Notifications").text.Equals("Other")) && // and "Other" is selected

((thisXDocument.DOM.selectSingleNode("my:CI/my:eek:ther").text.Equals("Enter
Notification Type...")) || // and no changes have been made

(thisXDocument.DOM.selectSingleNode("my:CI/my:eek:ther").text.Equals(""))))// or
the user just deleted "Enter Notification Type"
{ //then set focus to the 'other' textbo
thisXDocument.View.SelectText(thisXDocument.DOM.selectSingleNode("my:CI/my:eek:ther"),Type.Missing);
}
return;
}
}
 

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