Code: Select all
METHOD CancelEdit() CLASS TXBrowse
<... code ...>
// oCol:oEditGet:nLastKey := VK_RETURN // comment this line
< ... code ...>
return nil
//--------------------------------------------------------//
METHOD Edit( nKey ) CLASS TXBrwColumn
< .... code .... >
// ::oEditGet:bLostFocus := { || ::PostEdit() } // oldcode <--------
::oEditGet:bLostFocus := { || ::PostEdit(,,VK_ESCAPE) } // new coce <----------
< .....code......>
return .t.
//----------------------------------------------------------//
METHOD PostEdit( xValue, lButton, nLastKey ) CLASS TXBrwColumn // new code <----
// METHOD PostEdit( xValue, lButton ) CLASS TXBrwColumn // old code <-----
< ... code .. >
do case
case ::nEditType == EDIT_GET
If ::oEditGet != nil
// new code insert - begin
if nLastKey != nil
::oEditGet:nLastKey := nLastKey
endif
if ::oEditGet:nLastKey == VK_ESCAPE
::oEditGet:undo()
::oEditGet:Refresh()
endif
// new code insert - end
Eval( ::bOnPostEdit, Self, Eval( ::oEditGet:bSetGet ), ::oEditGet:nLastKey )
lGoNext := ( ::oEditGet:nLastKey == VK_RETURN )
::oEditGet:End()
::oEditGet := nil
endif
< ... further code ...>