OnCancelClose

Started by Jim Short, November 25, 2008, 12:48:53 PM

Previous topic - Next topic

Jim Short

Beta 5.0.1.3
OnCancelClose event is shown by definition to apply to File dialog, Modal dialog, and Modeless dialog. Does it also apply to a Control bar? My grid control is closing the control bar when enter pressed. It does not fire the OnCancelClose event. It also leaves a blank gray docked form after the control bar closes. I am working Fred Fred Tomke's example below.

;;handle escape and enter***

;;start edit event
(defun c:Onset_Outline_InfoGrid_OnBeginLabelEdit (row col)
  (setq tcam:*isLabelEdit* T)
)
;;edit done event
(defun c:Onset_Outline_InfoGrid_OnEndLabelEdit (row col)
  (setq tcam:*isLabelEdit* nil)
)

;;escape or enter event
(defun c:Onset_Outline_OnCancelClose (isESCWasPressed)
  (tcam:cancelGridEdit Onset_Outline_InfoGrid)
  ;;return true to keep form from closing after ENTER
  (/= isESCWasPressed 1)
)

;;general sub
;;cancel edit if in edit mode
(defun tcam:cancelGridEdit (ctrlName)
  (if isLabelEdit
    (dcl_Grid_CancelCellEdit ctrlName)
   )
)



Jim Short

owenwengerd

The control bar and palette do not support the OnCancelClose event because there is no safe way to prevent them from closing once the process has started. I just did a quick test, and pressing [Enter] or [Esc] in a control bar with a grid control did not close the form in AutoCAD 2009 on Vista.
Owen Wengerd (Outside The Box) / ManuSoft