Is there a way to programmatically de-select text in a TextField?
Setting .SelStart=0 and .SelLength=0 (from another window) doesn’t work, nor does it work from the .TextChanged event in the target TextField.
I also tied .SelText="" in both places, no joy.
2015r1. Windows 7, 64bit.
Scenario: User double clicks on a field on the main window. This opens a modal window where the user can find and select a doctor. The model window populates the textfield on the main window and closes. The doctors name is selected from the beginning to wherever the user double clicked in the field (despite the fact that the field was empty when the double click occured and therefore should not be trying to select anything.) This is leading to the destruction of the name when the user starts typing.
so this doesn’t work?
win1.textfield1.selstart=doctors_name.len // set cursor to END of the name
Ah-ha!!! That’s why getting more brains involved is a good thing. I didn’t think of that one.
Sadly, no. It didn’t change the behavior. Still selected from the start to the point where I double clicked.
I’m getting the feeling I’m fighting the low level built in auto text selector. Like when you normally double click in a field it selects all the characters in both directions until it reaches a non alpha-numeric character.
Ok, I feel old, tired.
Adding a return true in the .MouseDown event of the target field solves it. We are using the .DoubleClick event on a canvas positioned over the field. The double click was getting passed through.
Curiosity question: why do you position a canvas over a TextField? What does that give you that the TextField can not?
He seems to use double click in another way than the normal system behavior, which is to select the word under the cursor. And of course TextField does not have the doubleclick event.
I would not do that and probably would use right click instead, though.
Just as MS Word does, double click selects the whole word and a triple click selects the whole sentence. These things can be very handy.
Just as you in most cases i prefer the right click but sometimes ease and/or speed is important.
[quote=198191:@Andre Kuiper]Just as MS Word does, double click selects the whole word and a triple click selects the whole sentence. These things can be very handy.
Just as you in most cases i prefer the right click but sometimes ease and/or speed is important.[/quote]
This existed on Mac
since the first one ? (Lisa ?)
One click: place the cursor at the click position
Two clicks: select the word below the click position
Three clicks: select the whole paragraph
Four clicks: I do not recall
(Four Clicks Away ?)
Clic / Clack Merci Kodak
Click / Clack, Thanks Kodak ;-
A double click event. To enable the user to double click in the field to get to the doctor search window, which allows them to filter and find the doctor to enter into the field.
Nope, just stealing the double click event.
I know the implementation was a deviation from good user interface (one normally selects text by double clicking, not open new windows) but I wanted to maintain what they were used to. I went over to the hospital to demonstrate the issue and talk to them about it yesterday. It turns out that they don’t actually need the search functionality from the original search window, just the ability to narrow the long list of doctors down.
So I swiped a routine I developed for another app to allow the user to narrow down choices and populates a contextual menu. When they get three characters in the field a contextual menu pops up with the list of matches. They seem to like that.