TextField.CueText not showing on windows when control is focused

Hi there, I do not see an obvious place to post bug reports so I am assuming (perhaps incorrectly and if so my apologies) that I should post them here.

TextField.CueText displays the cue text in OSX when the control has focus with no typed text in it. In windows this is not the case, if the control has focus the CueText is wiped out.The CueText returns if you don’t input anything and move focus to another control.

I have not checked behaviour on a Linux Build, this lead to some unexpected issues with the ui design of my app.

I believe what you describe is the normal Windows TextField behavior.

However, if you want to report, download the Feedback app from Xojo.com and install it.

Thanks for pointing me to the feedback system :smiley:

There is a possible workaround, but that will require some doing. It can be made into a subclass on a ContainerControl if you have several textfields. Here is the principle :

  • Put a TextField on the window, of view (at left -200 or so)
  • Put a Canvas where the TextField is supposed to go
  • In the Paint event of the canvas, put :
TextField1.Drawinto(g,0,0)

To the user, this will just look like the TextField. But unlike the real thing, it won’t come to life when the mouse hovers, which prevent using a canvas over it to maintain the cueText.

Set the Canvas to accept focus.

In the canvas MouseDown, set focus to it, , draw the blue outline of a focused TextField and start a multiple timer which sole purpose is to simulate the blinking insertion point and invalidate the canvas. Since the TextField is in fact not focused yet, the cue text will show.

In the Keydown event of the Canvas,

  • Put the TextField on top of the canvas with the same left and top
  • Put the char in TextField1.Text
  • TextField.SetFocus
    Make sure that the canvas is in the back and the TextField in the front with the controls on top of the IDE.

In the TextField TextChange event, as soon as Text is “” again, put the TextField back off screen and set focus on the canvas so cue text shows.