EditTables – The CELLPOSCHANGED event

OpenInsight 10.2 adds a new event called CELLPOSCHANGED to the EDITTABLE control. This is effectively the same as the normal POSCHANGED event but with the addition of an extra parameter called “ContextFlags” that provides more information on why the event was raised.

bForward = CELLPOSCHANGED( CtrlEntID,   |
                           CtrlClassID, |
                           NextColumn,  |
                           NextRow,     |
                           ContextFlags )

ContextFlags is a simple bitmask integer that contains the following flags:

Bit Flag ValueDescription
0x00000001If set then the cell position was changed via a keystroke.
0x00000002If set then the cell position was changed via the mouse.

Equates for these flags can be found in the PS_EDITTABLE_EQUATES insert record:

Equ PS_EDT_CTF_NONE$         To 0x00000000;
Equ PS_EDT_CTF_KEYSTROKE$    To 0x00000001;
Equ PS_EDT_CTF_MOUSECLICK$   To 0x00000002;

Example – testing to see if the position (CARETPOS) was changed via a mouse click:

$Insert PS_EditTable_Equates

If BitAnd( ContextFlags, PS_EDT_CTF_MOUSECLICK$ ) Then
   // CARETPOS was changed by using the mouse.

Notes on using the CELLPOSCHANGED event

  1. The default promoted system CELLPOSCHANGED event handler performs the same processing as the default promoted system POSCHANGED event handler (i.e. data validation and required checking etc).
  2. If a CELLPOSCHANGED event handler is defined by the developer then a standard POSCHANGED event will not be raised.
  3. To preserve backwards compatibility with existing applications the default promoted system CELLPOSCHANGED event will not be compiled into a control if there is no CELLPOSCHANGED quick event handler. This is to ensure that POSCHANGED is always executed if CELLPOSCHANGED has not been explicitly set for a control by the developer.
  4. CELLPOSCHANGED is available in OpenInsight 10.2 from the Beta 3 release onwards.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s