2009-08-06 23:58 UTC
In the following code, I make a click event on buttons change the selection of a list box, however they do not appear to call the OnSelChanged event for the list box. The selection get's changed, but the events I want to happen when the selection is changed don't. The events are called when I change the selection manually though. Is this a known bug? Is there a workaround?
(defun RangeDisable (/)
(dcl_Control_SetValue chkRange 0)
(dcl_Control_SetEnabled txtRangeStart nil)
(dcl_Control_SetEnabled lblTo nil)
(dcl_Control_SetEnabled txtRangeEnd nil)
)
(defun c:lstBlocks_OnSelChanged (ItemIndex Value / NValue)
(RangeDisable)
(if (setq NValue (last (dcl_ListBox_GetSelectedItems lstBlocks)))
(dcl_DWGPreview_LoadDwg dwgPreview (strcat selectedfolder "\\" NValue))
)
(if (/= (dcl_ListBox_GetSelCount lstBlocks) 0)
(dcl_Control_SetCaption lblFiles (strcat (itoa (dcl_ListBox_GetSelCount lstBlocks)) " selected"))
(dcl_Control_SetCaption lblFiles "No Files Selected")
)
)
(defun c:btnSelectAll_OnClicked (/)
(dcl_ListBox_SelItemRange lstBlocks 0 (dcl_ListBox_GetCount lstBlocks) T)
(dcl_Control_SetCaption lblFiles (strcat (itoa (dcl_ListBox_GetCount lstBlocks)) " selected"))
)
(defun c:btnClearSelect_OnClicked (/)
(dcl_ListBox_SelItemRange lstBlocks 0 (dcl_ListBox_GetCount lstBlocks) F)
(dcl_Control_SetCaption lblFiles "No Files Selected")
)

(defun RangeDisable (/)
(dcl_Control_SetValue chkRange 0)
(dcl_Control_SetEnabled txtRangeStart nil)
(dcl_Control_SetEnabled lblTo nil)
(dcl_Control_SetEnabled txtRangeEnd nil)
)
(defun c:lstBlocks_OnSelChanged (ItemIndex Value / NValue)
(RangeDisable)
(if (setq NValue (last (dcl_ListBox_GetSelectedItems lstBlocks)))
(dcl_DWGPreview_LoadDwg dwgPreview (strcat selectedfolder "\\" NValue))
)
(if (/= (dcl_ListBox_GetSelCount lstBlocks) 0)
(dcl_Control_SetCaption lblFiles (strcat (itoa (dcl_ListBox_GetSelCount lstBlocks)) " selected"))
(dcl_Control_SetCaption lblFiles "No Files Selected")
)
)
(defun c:btnSelectAll_OnClicked (/)
(dcl_ListBox_SelItemRange lstBlocks 0 (dcl_ListBox_GetCount lstBlocks) T)
(dcl_Control_SetCaption lblFiles (strcat (itoa (dcl_ListBox_GetCount lstBlocks)) " selected"))
)
(defun c:btnClearSelect_OnClicked (/)
(dcl_ListBox_SelItemRange lstBlocks 0 (dcl_ListBox_GetCount lstBlocks) F)
(dcl_Control_SetCaption lblFiles "No Files Selected")
)
