OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: roy_043 on February 08, 2017, 08:48:57 AM

Title: Need help understanding DwgList.lsp (Samples)
Post by: roy_043 on February 08, 2017, 08:48:57 AM
I am trying to understand the DwgList.lsp sample.
The ComboBox1 control does not have any active events, yet if I change the current selection the DWGList1 control is updated. How does this work?

Aside:
The name of one of the event-handlers is still based on the old naming scheme:
c:DwgListForm_DwgList1_OnDblClicked
Title: Re: Need help understanding DwgList.lsp (Samples)
Post by: owenwengerd on February 09, 2017, 04:48:51 PM
I'm not sure I understand the question, but I suppose the behavior is hard-wired into the control.
Title: Re: Need help understanding DwgList.lsp (Samples)
Post by: owenwengerd on February 09, 2017, 05:36:13 PM
I checked source code, and the behavior is indeed hardwired. The folder combo searches for a DwgList control on the same form, then sends change notifications to the first one it finds.

P.S. I've fixed the event name in the sample. Thanks for pointing it out!
Title: Re: Need help understanding DwgList.lsp (Samples)
Post by: roy_043 on February 10, 2017, 12:50:05 PM
Thanks for your explanation Owen.

I would like to suggest an improvement for the c:DwgList/DwgListForm/cmdUP#OnClicked function.
Currently using the 'Up' button causes all parents except the current, to be dropped from the combo list. Which is confusing and also means you are then restricted to a single drive. Using dcl-ComboBox-AddPath instead of dcl-ComboBox-Dir can fix this.

Code (autolisp) Select
(defun c:DwgList/DwgListForm/cmdUP#OnClicked ( / sPath)
  (setq sPath (strcat (dcl-ComboBox-GetDir DwgList/DwgListForm/ComboBox1) "\\.."))
  ; (dcl-ComboBox-Dir DwgList/DwgListForm/ComboBox1 sPath)
  (dcl-ComboBox-AddPath DwgList/DwgListForm/ComboBox1 sPath)
  (dcl-DWGList-Dir DwgList/DwgListForm/DwgList1 sPath)
  (princ)
)
Title: Re: Need help understanding DwgList.lsp (Samples)
Post by: owenwengerd on February 11, 2017, 07:23:27 PM
I've updated the sample (including a few other improvements) for the next update. Thanks!