hi,
sorry i have descript it wrong :
when using TAB Key it will "mark" all when get into TEXTBOX -> GOTFOCUS
when "click" into a TEXTBOX it will not show "mark"
also when Field was empty TEXTBOX is not "marked"
so i try to use EM_SETSEL with ONGOTFOCUS which should react when "click" into TEXTBOX
but it seems not to work "on click"
( except empty TEXTBOX )
Code: Select all
DEFINE TEXTBOX Text_001+
ONGOTFOCUS MarkText(ThisWindow.Name, This.Name )
ONLOSTFOCUS DeHilite(ThisWindow.Name, This.Name )
Code: Select all
PROCEDURE MarkText( ParentForm, ControlName )
LOCAL cValue, hWndEdit, nStartIndex := 0, nEndIndex := - 1
IF _IsControlDefined( ControlName, ParentForm )
DoMethod(ParentForm, ControlName, "SetFocus") // add try Mol
SetProperty(ParentForm, ControlName, "CaretPos", nEndIndex ) // add try Mol
cValue := GetProperty( ParentForm, ControlName, "Value" )
IF EMPTY( cValue )
SetProperty(ParentForm,ControlName,"BackColor",SP_nColor11() )
SetProperty(ParentForm,ControlName,"FontColor",SP_nColor12() )
ELSE
IF VALTYPE(cValue) <> "C"
cValue := hb_valToExp(cValue)
ENDIF
nEndIndex := LEN(TRIM(cValue))
hWndEdit := GetControlHandle( ControlName, ParentForm )
SendMessage(hWndEdit, EM_SETSEL, nStartIndex, nEndIndex)
ENDIF
ENDIF
RETURN
Code: Select all
PROCEDURE DeHilite( ParentForm, ControlName )
IF _IsControlDefined( ControlName, ParentForm )
SetProperty(ParentForm,ControlName,"BackColor",SP_nColor5() )
SetProperty(ParentForm,ControlName,"FontColor",SP_nColor6() )
ENDIF
RETURN