TXBrowse EditType 1 Suggested fixes

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

TXBrowse EditType 1 Suggested fixes

Post by nageswaragunupudi »

With the following 3 changes TXBrowse inline Edit ( edittype 1 singleline ) seem to be working reliably.

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 ...>
Regards

G. N. Rao.
Hyderabad, India
Post Reply