::oShipCons:bGotFocus := { || ::oShipCons:PostMsg( WM_KEYDOWN, VK_HOME ), ::oShipCons:selectall(), ::oShipCons:PostMsg( WM_KEYUP ) }
I think it would be better to have "@K" supported by the tget class. So I added 3 lines of code to tget.prg and it seems to work pretty good.
Can this be added to the regular class?
around line 1516 in tget.prg method gotfocus()
if ! Empty( ::cPicture ) .and. "K" $ ::cPicture
::SelectAll()
endif
here is the entire method
- Code: Select all Expand view
METHOD GotFocus( hCtlLost ) CLASS TGet
::lFocused = .t.
#ifdef __XHARBOUR__
::oGet:VarGet()
#endif
#ifdef __XPP__
DEFAULT ::lClrFocus := .F.
#endif
if ! Empty( ::cPicture ) .and. ::oGet:Type == "N"
::oGet:Picture := StrTran( ::cPicture, ",", "" )
endif
if ! ::lDrag
::oGet:KillFocus() // to properly initialize internal status
::oGet:SetFocus()
if Upper( ::oWnd:ClassName() ) == "TCOMBOBOX"
::oGet:Buffer := ::oGet:Original
endif
if ::lClrFocus
::nOldClrPane = ::nClrPane
::SetColor( ::nClrText,;
If( ValType( ::nClrFocus ) == "B", Eval( ::nClrFocus ), ::nClrFocus ) )
endif
::DispText()
if ::oGet:Type $ "DN" .or. ::oGet:Pos != 1 // 28/06/05 AL
::nPos := ::oGet:Pos // 1 28/06/05 AL
endif
::oGet:Pos := ::nPos
::SetPos( ::nPos )
CallWindowProc( ::nOldProc, ::hWnd, WM_SETFOCUS )
if Set( _SET_INSERT )
DestroyCaret()
CreateCaret( ::hWnd, 0, 6, ::nGetChrHeight() - 1 )
ShowCaret( ::hWnd )
endif
// Here is the "@K" modification
if ! Empty( ::cPicture ) .and. "K" $ ::cPicture
::SelectAll()
endif
else
HideCaret( ::hWnd )
endif
Super:GotFocus( hCtlLost )
return 0