Forum > LCL
[Solved] How to unselect the text in a focused TEdit, programmatically
Bart:
Are you using a TMaskEdit?
In that case: it'll always select at leas one character in the control when you type or tab into the control.
Setting SelLength to zero should just work (also for a TMaskEdit).
Bart
cdbc:
Hi
Thanks Bart - No it's not and no it didn't... %)
Plain ol' TEdit.
Regards Benny
ackarwow:
--- Quote from: cdbc on November 25, 2024, 06:35:27 pm ---Hi
Sorry guys, neither of your suggestions worked...
I'd like for the user to type onto the end of the pretext, but alas, when it's selected, the pretext just gets overwritten.
I've also tried:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- edtMask.SelStart:= bcLengthUTF8(edtMask.Text); edtMask.SelLength:= 0;or edtMask.Perform(LM_KEYDOWN,VK_END,VK_END); edtMask.Perform(LM_KEYUP,VK_END,VK_END); Hmmm, what's next, to try...
Regards Benny
--- End quote ---
@Benny
When do you call this code (what event)?
cdbc:
Hi
--- Quote ---When do you call this code (what event)?
--- End quote ---
It gets called just after I assign the 'pretext' to edtMask.Text, in the 'change-handler' for edtMask...
Regards Benny
dsiders:
--- Quote from: Bart on November 25, 2024, 06:40:28 pm ---
--- Quote from: dsiders on November 25, 2024, 06:12:12 pm ---TEdit.ClearSelection
--- End quote ---
TEdit.ClearSelection: Removes the selected text from the edit control.
I think that's not what TS wants.
Bart
--- End quote ---
Doh. My bad.
Navigation
[0] Message Index
[#] Next page
[*] Previous page