Hello,
I notice that entering some text using .seltext when a textField does not gave the focus, arises some problems:
for instance, in a window I have a textfield, and a pushbutton containing this snippet:
pushbutton1.action event: TextField1.SelText = “1”
Now, clicking the pushbutton several times, if the textfield does NOT have the focus, in the field I get only “11”. Never “111” or “1111” etc.
So I thought to give the focus to the text field, so the pushButton now has this code
TextField1.SetFocus
TextField1.SelText = “1”
But each time I click the button, the textfield erases its content and prints “1”. In other words, the content of the field is always “1”
At present my workarounds are these:
to have it work without giving the focus:
TextField1.SelStart = TextField1.SelStart
TextField1.SelText = “1”
To have it work giving focus to the field:
dim i as Integer = TextField1.SelStart
TextField1.SetFocus
TextField1.SelStart = i
TextField1.SelText = “1”
Could this be considered a bug to be notified through Feedback? Thanks.
Sierra
Xojo 2016 and 2017v2.1, both 32 and 64bit
[quote=355508:@Carlo Rubini]Mac OS 10.12.6
Xojo 2016 and 2017v2.1, both 32 and 64bit
Are you sure the testfield does NOT have the focus?
Try adding a second textfield and manually give it the focus; then push the button several times.[/quote]
you are correct… if it doesn’t have focus it reacts like you described…