Page 3 of 3

Re: Seleccionar todo el texto en un TextBox

Posted: Sat Jan 22, 2022 6:23 am
by mol
Thanks Jimmy for your work, but everything works OK with the keyboard, and everything goes wrong with the mouse.
I've prepared little function, which call should be placed in OnGetFocus statement.
It works perfectly for me:

Code: Select all

#define WM_SETTEXT 12
function ClearTextBoxIfEmpty
	
	if empty(this.Value)
		SendMessage( GetControlHandle(This.Name, ThisWindow.Name) , WM_SETTEXT , 0, "" ) 
	endif
return

Re: Seleccionar todo el texto en un TextBox

Posted: Sat Jan 22, 2022 7:25 am
by AUGE_OHR
hi Mol,

now i "see" the Differenz.

my Code does "hilight" TEXTBOX when click into it
but it does not "clear" TEXTBOX when begin to type into. it will be "add" at Caret Position

so try to change

Code: Select all

   SetProperty( ParentForm, ControlName, "CaretPos", nEndIndex )
into

Code: Select all

   SetProperty( ParentForm, ControlName, "CaretPos", nStartIndex )
to get right Start Position

btw. how to "switch" between "INSERT" and "OVERRIDE" in TEXTBOX / EDITBOX :?: