OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: maweilian on March 12, 2009, 09:08:45 AM

Title: trouble with tree control OnEndLabelEdit Event
Post by: maweilian on March 12, 2009, 09:08:45 AM
I have a tree control in my form with which I want my users to ba able to edit the labels.  However, I am having trouble figuring out how to do this.  So far I have this code in my LISP file:


;;;define action when the label has begun to be edited
(defun c:partlibmain_PartLibMain_Tree2_OnBeginLabelEdit (Key /)
  (setq LabelEditBeginValue (dcl_Tree_GetItemLabel partlibmain_PartLibMain_Tree2 Key))
);end defun

;;;define action when the label has finished editing [not working properly]
(defun c:partlibmain_PartLibMain_Tree2_OnEndLabelEdit (NewValue Key /)
  (if (= NewValue "")
    (dcl_Tree_SetItemLabel partlibmain_PartLibMain_Tree2 Key LabelEditBeginValue)
    (progn
     
     ... code here to perform operations with the new label value ...

    );end progn
  );end if
);end defun

;;define action when return is pressed while operating in the treeview control
(defun c:partlibmain_PartLibMain_Tree2_OnReturnPressed (/)
  (dcl_Tree_CancelLabelEdit partlibmain_PartLibMain_Tree2)
);end defun


When I run the application, I can edit the labels but once I press return or click somewhere else on the form, my edits disappear and are not passed to the OnEndLabelEdit event handler.

What am I missing or doing wrong?

Thanks,
Will
Title: Re: trouble with tree control OnEndLabelEdit Event
Post by: owenwengerd on March 12, 2009, 09:41:44 AM
It was a bug. I've fixed it now for the next build so that it passes back the new label and updates the control.