Sergio, para conseguir lo que pretendes necesitas o modificar la clase TCombobox, o utilizar una clase que herede de ella ya que el problema está, según creo, en el método Keychar de la clase
Te adjunto una clase que tenía hecha hace tiempo para ello, y solo la usaba en los Combobox de la aplicación en los que necesitaba esta funcionalidad.
Es muy sencilla de implementar incluso en la propia clase TCombobox, aunque yo prefiero siempre no modificar las clases iniciales (cuestion de gustos)
// El comando ha de ser modificado
#xcommand @ <nRow>, <nCol> MCOMBOBOX [ <oCbx> VAR ] <cVar> ;
[ <it: PROMPTS, ITEMS> <aItems> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ <dlg:OF,WINDOW,DIALOG> <oWnd> ] ;
[ <help:HELPID, HELP ID> <nHelpId> ] ;
[ ON CHANGE <uChange> ] ;
[ VALID <uValid> ] ;
[ <color: COLOR,COLORS> <nClrText> [,<nClrBack>] ] ;
[ <pixel: PIXEL> ] ;
[ FONT <oFont> ] ;
[ <update: UPDATE> ] ;
[ MESSAGE <cMsg> ] ;
[ WHEN <uWhen> ] ;
[ <design: DESIGN> ] ;
[ BITMAPS <acBitmaps> ] ;
[ ON DRAWITEM <uBmpSelect> ] ;
[ STYLE <nStyle> ] ;
[ <pict: PICT, PICTURE> <cPicture> ];
[ ON EDIT CHANGE <uEChange> ] ;
=> ;
[ <oCbx> := ] TMComboBox():New( <nRow>, <nCol>, bSETGET(<cVar>),;
<aItems>, <nWidth>, <nHeight>, <oWnd>, <nHelpId>,;
[{|Self|<uChange>}], <{uValid}>, <nClrText>, <nClrBack>,;
<.pixel.>, <oFont>, <cMsg>, <.update.>, <{uWhen}>,;
<.design.>, <acBitmaps>, [{|nItem|<uBmpSelect>}], <nStyle>,;
<cPicture>, [<{uEChange}>], [<(oCbx)>] )
//---------------------------------------------------------------------------//
CLASS TMComboBox FROM TComboBox
DATA lOpen
METHOD New( nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId,;
bChange, bValid, nClrText, nClrBack, lPixel, oFont,;
cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, nStyle,;
cPict, bEChange ) CONSTRUCTOR
METHOD KeyChar( nKey, nFlags )
ENDCLASS
//---------------------------------------------------------------------------//
METHOD New( nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId,;
bChange, bValid, nClrText, nClrBack, lPixel, oFont,;
cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, nStyle,;
cPict, bEChange ) CLASS TMComboBox
::lOpen := .F.
::Super:New( nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId,;
bChange, bValid, nClrText, nClrBack, lPixel, oFont,;
cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, nStyle,;
cPict, bEChange )
Return Self
//---------------------------------------------------------------------------//
METHOD KeyChar( nKey, nFlags ) CLASS TMComboBox
local nNewAT := 0, nOldAT := ::nAT, uItem
if Len( ::aItems ) == 0
return 0
endif
if ::lIncSearch
do case
case nKey = 32 // VK_DELETE (DO NOT WORK!)
if Empty( ::oGet:hWnd )
::cSearchKey = ""
nNewAt = 1
uItem = ::aItems[ nNewAt ]
else
::cSearchKey += " "
endif
case nKey = VK_BACK
::cSearchKey = Left( ::cSearchKey, Len( ::cSearchKey ) - 1 )
case nKey = 190
nKey = 0
::cSearchKey += "."
case ! Empty( ::oGet:hWnd ) .and. nKey = VK_TAB
if ! GetKeyState( VK_SHIFT )
::oWnd:GoNextCtrl( ::hWnd )
else
::oWnd:GoPrevCtrl( ::hWnd )
endif
return 0
otherwise
if nKey <> VK_RETURN
if ::lCaseSensitive
::cSearchKey += Chr( nKey )
else
::cSearchKey += Upper( Chr( nKey ) )
endif
endif
endcase
if nKey <> VK_RETURN
if Empty( uItem )
if nNewAt == 0
if ::lCaseSensitive
nNewAt = AScan( ::aItems, { | x | SubStr( x, 1, Len( ::cSearchKey ) ) == ::cSearchKey } )
else
nNewAt = AScan( ::aItems, { | x | SubStr( Upper( x ), 1, Len( ::cSearchKey ) ) == ::cSearchKey } )
endif
if Empty( ::oGet:hWnd )
uItem = ::aItems[ If( nNewAt > 0, nNewAt, Max( ::nAT, 1 ) ) ]
else
uItem = If( nNewAt > 0, ::aItems[ nNewAt ], ::cSearchKey )
MsgInfo( uItem )
endif
else
uItem = ::aItems[ Max( nNewAt, 1) ]
endif
endif
::Set( If( ValType( Eval( ::bSetGet ) ) == "N", AScan( ::aItems, uItem ), uItem ) )
if ! Empty( ::oGet:hWnd )
::oGet:SetPos( Len( ::cSearchKey ) + 1 )
endif
endif
endif
if ::bChange != nil
if ! Empty( ::oGet:hWnd ) .or. ( nNewAT != nOldAt .and. nNewAt != 0 )
Eval( ::bChange, Self, ::VarGet() )
endif
endif
if nKey == VK_RETURN
if ::IsOpen()
//return ::GoNextCtrl( ::hWnd )
else
if ::lOpen
::lOpen := .F.
return ::oWnd:GoNextCtrl( ::hWnd )
else
::Open()
::lOpen := .T.
endif
endif
endif
return If( ::lIncSearch, 0, nil )
//----------------------------------------------------------------------------//
Como ves, sólo he añadido una DATA (aunque de igual manera podrías utilizar la DATA cargo en su lugar) y modificado el METODO KEYCHAR