Need help understanding DwgList.lsp (Samples)

Started by roy_043, February 08, 2017, 08:48:57 AM

Previous topic - Next topic

roy_043

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

owenwengerd

I'm not sure I understand the question, but I suppose the behavior is hard-wired into the control.

owenwengerd

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!

roy_043

#3
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)
)

owenwengerd

I've updated the sample (including a few other improvements) for the next update. Thanks!