Is there a way to temporarily switch off an event apart from using a nested dummy function (see code)?
;;; KG_ODCL_Tree_FolderTree_Menu_PutCurrent expands the tree and selects an item in the tree
(defun KG_ODCL_Tree_FolderTree_Menu_PutCurrent
(
; code removed
/
; code removed
KG_ODCL_Tree_FolderTree_Menu_OnItemExpanded ; dummy nested function to replace global fuction
KG_ODCL_Tree_FolderTree_Menu_OnSelChanged ; dummy nested function to replace global fuction
)
(defun KG_ODCL_Tree_FolderTree_Menu_OnItemExpanded (inputList label key) nil)
(defun KG_ODCL_Tree_FolderTree_Menu_OnSelChanged (inputList label key) nil)
; code removed
)
(defun c:FolderTreeTest_Main_Tree_OnSelChanged (label key / tmp)
;; KG_ODCL_Tree_FolderTree_Menu_OnSelChanged is sometimes replaced by a nested dummy function that returns nil!!
(if (setq tmp (KG_ODCL_Tree_FolderTree_Menu_OnSelChanged FolderTreeMenuData key))
(setq FolderTreeMenuData tmp)
)
'T ; returning an inputList will cause a crash in BC 11.4.6
)
Hi, there are two ways to do:
1: use a variable to suppress the execution of an event.
Example:
(defun c:myproj_myform_OnInitialize()
[...]
(setq doInit nil)
); c:myproj_myform_OnInitialize
(defun c:myproj_myform_OnSize(intNewWidth intNewHeight)
(if (not doInit)
[...]
); if
); c:myproj_myform_OnSize
(setq doInit T)
(dcl_form_show myproj_myform)
2. Attach an event name to the event property at runtime.
Example:
(dcl_control_setproperty myproj_myform_edtName "EditChanged" "") ;; turn off the event
(dcl_control_setproperty myproj_myform_edtName "EditChanged" "c:myproj_myform_edtName_OnEditChanged") ;; turn on the event
Regards, Fred
Your solution #2 is what I was looking for. Many thanks for your help!