Grid_CancelEdit on ReturnPressed

Started by Fred Tomke, May 13, 2008, 02:48:30 AM

Previous topic - Next topic

Fred Tomke

Hello,

For some releases I feel that it would be nice when an editable gridcell would be "closed" if the user presses return (to invoke grid_cancelitemedit). When the user presses return now (in 5.0.0.14 and 5.0.0.15 DEU), the cell stays in "open" mode and is still editable.

1. Is this by design?
2. Is this a detail (better word for bug  ;) )?
3. May I add this as a new feature?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Hello,

I've found out that in some cases the event CancelClose of the form is being called when the user presses return in an "open" cell in a grid. I got it during testing a different form than in my initial message.

In the cases CancelClose will be called you can do this:


  (defun c:layer_sc_layer_props_OnCancelClose (bCancelling /)
    (cond
      ((= bCancelling 1) (setq lstResult nil))
      (isEdit (dcl_Grid_CancelItemEdit layer_sc_layer_props_grd_props))
    ); cond
    (/= bCancelling 1)
  ); c:layer_sc_layer_props_OnCancelClose

  (defun c:layer_sc_layer_props_grd_props_OnBeginLabelEdit (intRow intCol / lstItem)
    (setq isEdit T)
    ;; something senseful
  ); c:layer_sc_layer_props_grd_props_OnBeginLabelEdit

  (defun c:layer_sc_layer_props_grd_props_OnEndLabelEdit (intRow intCol / lstItem intPic uValue intStyle)
    ;; something senseful
    (setq isEdit nil)
  ); c:layer_sc_layer_props_grd_props_OnEndLabelEdit

  (defun c:layer_sc_layer_props_pb_accept ( /)
    (if isEdit (dcl_Grid_CancelItemEdit layer_sc_layer_props_grd_props))
    (setq lstResult (list "Something Senseful"))
    (dcl_form_close layer_sc_layer_props)
  ); c:layer_sc_layer_props_pb_accept

  (defun c:layer_sc_layer_props_pb_cancel ( /)
    (setq lstResult nil)
    (dcl_form_close layer_sc_layer_props)
  ); c:layer_sc_layer_props_pb_cancel



Maybe somebody is looking for such a solution.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Fred, can you be more specific about what cell styles behave this way?  The cell editor should decide what to do with a return press while editing, and it may very well be that some handle it incorrectly. I would expect the return press to be passed along to the form if the editor does not handle it.

Fred Tomke

Hello Owen,

please image a grid with cells for text input or integer input.
If you click in this cell you can edit the content. If you press Enter the cell is still editable (I'm not sure if EndLabelEdit is being called then). I thought I can remember that in earlier releases after pressing Enter the cell was not in editable mode but only selected.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Hello Owen, maybe it could be more clear with a video.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Fred, I created a modeless test form with a grid that has an "Integers" style cell. When I edit the cell and press [Enter], I get a call to OnEndLabelEdit followed by a call to OnCancelClose.  As you note, returning T from OnCancelClose prevents the dialog from closing.

In this case, everything appears to be working as designed.

Fred Tomke

Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]