No WebTextField HasFocus property plus no AppendText Method

I want to detect when a WebTextField has the focus. I can use the GotFocus event and set my own WebTextField1HasFocus property but I am surprised this isn’t built-in. Am I missing something?

Also, I like the idea of using the AppendText method to avoid flickering text when updating the text field. However, there is no AppendText method for the WebTextField. I could use a WebTextArea but I don’t want the scroll bars. Any suggestions?

What are you trying to accomplish with a focus property that you can’t just do in the GotFocus event? That said, you could create your own subclass of WebTextField with the property, setting/unsetting it in the focus events.

What flickering? AppendText is there for TextAreas because there could potentially be lots of text in the control, so replacing all of it can cause delays. But that shouldn’t be the case with regular fields.

You answered my first question. I thought there might already be an event in there for this that wasn’t obvious. I am trying to find out which of three textfields currently has the focus. Still not clear why a HasFocus isn’t included; it would be more convenient, that’s all. Not a big deal though.

I don’t have flickering. Even so, it seems like it would make sense to include it. If the AppendText method avoids flickering for large amounts of text, it implies that this method might be more efficient than using webtextfield1.text = webtextfield1 + newtextstring. Also, webtextfield1.appendtext(newtextstring) is slightly more compact.

Here is HasFocus :

  • Drag a WebTextField into the project
  • Click it and select Add ; Add Property
  • Call the Property HasFocus and make it boolean
  • Click the WebTextField and add in the GotFocus event : HasFocus = True
  • Click the WebTextField and add in the LostFocus event : HasFocus = False

Then drag the WebTextField over your WebPage ; it creates a subclass that has a property called WebTextField.HasFocus which is True or False over your WebPage scope :slight_smile:

Each subclassed instance of course has its own HasFocus : WebTextField1.HasFocus, MyTextField.HasFocus, TheThirdOne.HasFocus and so on. You can then scan your textfields HasFocus to find out which one has the focus.

That’s similar to what I ended up doing. I just think it is odd it isn’t built-in (that’s my main point here).