Grid InPlaceEditEvent

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
vagblad
Posts: 174
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Grid InPlaceEditEvent

Post by vagblad »

Hi to everyone,

I am using a Grid in which i am editing values cell by cell using VALID. This is the grid definition

Code: Select all

DEFINE GRID Grid_1
  PARENT NewFields
  ROW    50
  COL    10
  WIDTH  770
  HEIGHT 470
  WIDTHS aWidths
  HEADERS aHeaders
  ITEMS aItems
  COLUMNVALID aValid
  COLUMNWHEN aColumnWhen
  INPLACEEDIT ainPlaceEdit
  ON INPLACEEDITEVENT ProcGridInplaceEditEvent()
  TOOLTIP ''
  NOTABSTOP .F.
  PAINTDOUBLEBUFFER .T.
  VISIBLE .T.
  SHOWHEADERS .T.
  NOLINES .F.
  READONLY .F.
  ALLOWEDIT .T.
  CELLNAVIGATION .T.
END GRID
I want the user to move to the next cell when he finishes editing the previous one and presses enter. So i use the ON INPLACEEDITEVENT procGridInplaceEditEvent() which is this one:

Code: Select all

*-----------------------------------------
FUNCTION ProcGridInplaceEditEvent()
*-----------------------------------------
DO CASE
  CASE This.IsInplaceEditEventFinish == .T.
    _PushKey( VK_RETURN )
END CASE 
With NAVIGATION EXTENDED this works just fine. User edits a cell, presses ENTER and then the program moves him to the next cell and ready to type in the new values. Now my problem is that sometimes i may want to cancel the editing sequence, so i have a cancel button. The thing is that whatever i've tried i couldn't find a way to stop the VALID event running. So if you enter one cell to edit it then you have to move through the whole line of the grid until the VALID no longer procs.

Anyone has any idea of how to deal with it? Maybe i am going completely the wrong way with the ON InplaceEditEvent? Thanks in advance
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: Grid InPlaceEditEvent

Post by SALINETAS24 »

vagblad wrote: Mon Nov 28, 2022 12:11 pm Hi to everyone,

I am using a Grid in which i am editing values cell by cell using VALID. This is the grid definition

Code: Select all

DEFINE GRID Grid_1
     .. //..
FUNCTION ProcGridInplaceEditEvent()
*-----------------------------------------
DO CASE
  CASE This.IsInplaceEditEventFinish == .T.
    _PushKey( VK_RETURN )
END CASE 
With NAVIGATION EXTENDED this works just fine. User edits a cell, presses ENTER and then the program moves him to the next cell and ready to type in the new values. Now my problem is that sometimes i may want to cancel the editing sequence, so i have a cancel button. The thing is that whatever i've tried i couldn't find a way to stop the VALID event running. So if you enter one cell to edit it then you have to move through the whole line of the grid until the VALID no longer procs.

Anyone has any idea of how to deal with it? Maybe i am going completely the wrong way with the ON InplaceEditEvent? Thanks in advance
Hola, de esta forma cuando pulsas la tecla ESC finaliza la edición. Siempre la puedes activar desde un boton.

Code: Select all

		IF HMG_GetLastVirtualKeyDown()!=27
				_PushKey( VK_RETURN )
		ENDIF
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
Post Reply