Es una clase que deriva directamente de TControl, pero no me deja controlar VK_RETURN ni desde ::KeyDown ni desde ::KeyChar. Algo estoy haciendo mal y no me doy cuenta
![Shocked :shock:](./images/smilies/icon_eek.gif)
¿Alguna idea?
Como el código es cortito, lo incluyo a continuación:
#include "FiveWin.ch"
#ifdef __XPP__
#define Super ::TControl
#define New _New
#endif
//----------------------------------------------------------------------------//
CLASS TFondo FROM TControl
CLASSDATA lRegistered AS LOGICAL
METHOD New( nTop, nLeft, nBottom, nRight, oWnd, nClrLetr, nClrFond, oCursor, lBorder, lTabStop ) CONSTRUCTOR
METHOD Paint()
METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint()
METHOD LButtonDown( nRow, nCol, nKeyFlags )
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nTop, nLeft, nBottom, nRight, oWnd, nClrLetr, nClrFond, oCursor,lBorder, lTabStop ) CLASS TPanel
DEFAULT nTop := 0, nLeft := 0, nBottom := 100, nRight := 100,;
oWnd := GetWndDefault(), nClrLetr := 0, nClrFond := GetSysColor(COLOR_WINDOW ), lBorder := .F., lTabStop := .F. // Añadido
::nTop = nTop
::nLeft = nLeft
::nBottom = nBottom
::nRight = nRight
::oWnd = oWnd
::nStyle = nOr( WS_CHILD, WS_VISIBLE,IF(lBorder,WS_BORDER,0),IF(lTabStop,WS_TABSTOP,0) ) // esto ha variado respeto de TPanel
::lDrag = .f.
#ifdef __XPP__
DEFAULT ::lRegistered := .f.
#endif
*
::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
::SetColor(nClrLetr, nClrFond ) // AÑADIDO
*
IF ! Empty( ::oWnd:hWnd )
::Create("TFondo")
::lVisible = .T.
::oWnd:AddControl( Self )
ELSE
::lVisible = .F.
::oWnd:DefControl( Self )
ENDIF
IF oCursor # NIL // tambien añadido[
::oCursor := oCursor
SetCursor( ::oCursor:hCursor )
ENDIF
::lActive := .T.
::lDrag := .F.
::lCaptured := .F.
::lFocused := .F.
RETURN Self
*
METHOD Paint() CLASS TPanel
LOCAL nTop, nLeft, nHeight, nWidth, nBevel
*
IF ::oClient != NIL .AND. (nBevel := ::oClient:nClientBevel) > 0 // TODO ESTO EN ADELANTE ES DE TPanel
nBevel -= 1
nTop := nBevel
nLeft := nBevel
nHeight := ::nHeight - nBevel - 1
nWidth := ::nWidth - nBevel - 1
IF ::oTop != NIL
nTop += ::oTop:nHeight
ENDIF
IF ::oBottom != NIL
nHeight -= ::oBottom:nHeight
ENDIF
IF ::oLeft != NIL
nLeft += ::oLeft:nWidth
ENDIF
IF ::oRight != NIL
nWidth -= ::oRight:nWidth
ENDIF
WndBoxIn(::hDC, nTop, nLeft, nHeight, nWidth)
ENDIF
*
IF ::bPainted # NIL // ESTO ESTA AÑADIDO
Eval( ::bPainted, ::hDC )
ENDIF
RETURN NIL
*
METHOD LButtonDown( nRow, nCol, nKeyFlags ) CLASS TPanel // ESTO TAMBIEN ES NUEVO
IF ::bGotFocus # NIL
::SetFocus()
ENDIF
IF ::bLClicked != nil
RETURN Eval( ::bLClicked, nRow, nCol, nKeyFlags )
ENDIF
RETURN NIL*
Gracias por adelantado