In the Xojo TextField the Text alignment with different Fonts is horrible. So I programmed my own TextField subclassed from Canvas.
Let’s call it clsTextField.
Everthing works great, I can get Focus with Mous click, I get Focus when I Tab through the controls on a window.
I put 2 controls on a window, 1 Xojo TextField and 1 clsTextField, clsTextField has TabIndex 0 the Xojo TextField has TabIndex 1
When the window opens, allways the Xojo TextField has the Focus, even if it has TabIndex 1
Setting a statement ‘clsTextField.SetFocus’ in the window Open event does not help.
The only way I can force that my clsTextField has Focus is when I set TabStop to False in Xojo TextField, but now I lost the ability to tab through
How can I get the Focus on my Canvas Subclassed clsTextField when the window opens?
Is clsTextField.AcceptFocus set to True?
Yes, it is set to True
If I have multiple clsTextEdit controls on a window I can change Focus with the Tab key without problem.
Also with mixed controls (Xojo TextFields and clsTextFields) Tab key works as expected.
But on opening the window I am not able to set the Focus to a clsTextField, Focus jumps always to a Xojo TextField
Can you use a Timer that starts when the Window opens to set the focus? Sometimes this causes enough of a change in event order that strange behavior goes away.
This could be a bug, though. Does it happen on all platforms? Just Cocoa? You should create a Feedback case with a sample project so we can review it.
It happens only in Cocoa. I am working with OS 10.8.4, unable to test on Windows.
Same Program compiled in Carbon behaves as expected,
when window opens the control with TabIndex 0 gets the Focus (either my own clsTextField or a Xojo TextField)