Having an issue with dcl_ComboBox_SetCurSel

Started by Chris K, May 03, 2011, 09:17:48 AM

Previous topic - Next topic

Chris K

I'm using OpenDCL to manage layer modifiers by discipline and subdiscipline.  As part of the the initial setup I set the current selection to the discipline and subdiscipline for the current drawing.  All works great until the discipline is the last one in the list.  Then, the next to last item is set active and you are not allowed to select the last item.

Code (autolisp) Select

;; fill cboDiscipline
(defun Fill_cboDiscipline (/ cboList discipline)
  (dcl_Combobox_Clear LayerToolsForms_frmSetSystem_cboDiscipline)
  (setq discipline (cdr (assoc "Disc" (cdr (getfileinfo))))
cboList    (acad_strlsort
     (mapcar
       'car
       (GetDisciplineListByName)
     )
   )
  )
  (if (/= nil cboList)
    (progn
      (dcl_Control_SetList
LayerToolsForms_frmSetSystem_cboDiscipline
cboList
      )
      (if (member discipline cboList)
(dcl_ComboBox_SetCurSel
  LayerToolsForms_frmSetSystem_cboDiscipline
  (- (length cboList) (length (member discipline cboList)))
)
(dcl_ComboBox_SetCurSel
  LayerToolsForms_frmSetSystem_cboDiscipline
  0
)
      )
    )
  )
 
)

Anyone else experience a similar issue?
Below are a couple of items needed to test the code. I'm using version 6.0.2.2.

GetFileInfo - returns a list with the following info for a drawing name "01RGA.dwg"
("01RGA"
   ("Bldg" . "01")
   ("BldgName" . "TUNNEL")
   ("Disc" . "Process")
   ("DiscAbbrev" . "R")
   ("SubDisc" . "Gases")
   ("SubDiscAbbrev" . "G")
   ("System" . "")
   ("SystemAbbrev" . "")
   ("Series" . "")
   ("Lvl" . "A")
   ("Sec" . "")
   ("SubSec" . "")
   ("Sequence" . "")
   ("SubSequence" . "")
   ("Switchboard" . "")
   ("SwitchboardSide" . "")
   ("Switch" . "")
   ("Column" . "")
   ("LookingDir" . "")
   ("DrawingType" . "Process Gases Base File")
   ("DrawingTypeID" . 1.0)
   ("IsBaseFile" . T)
   ("IsBaseGrid")
   ("IsSection")
   ("IsBaseBuildFile")
   ("IsWorkorder")
   ("IsXSheet")
   ("IsHookupFile")
   ("IsDetail")
   ("IsSUD")
   ("IsCover")
   ("IsPlan")
   ("IsPartial")
   ("IsTemp")
   ("IsModel")
   ("IsPOC")
   ("IsOp")
   ("IsDemo")
   ("IsUnderground")
   ("IsUnnamed")
   ("IsError")
   ("ErrorMsg" "")
)

GetDisciplineListByName - returns a list with the following info:
(
   ("Life Safety" . "B")
   ("Civil" . "C")
   ("Fire Protection" . "F")
   ("Plumbing" . "P")
   ("Process" . "R")
)
Fake it 'til you make it.

owenwengerd

I don't see anything wrong with your code. Can you attach a simple example .odcl and .lsp file that demonstrates the problem?

Chris K

Wierd.  I put together a little test form using the same code and it works as expected. I'm at a lost.  Still will not work with the same code in the main application.
Fake it 'til you make it.

owenwengerd

It may be a bug in your code, or it could be some unusual condition that exposes a bug. In any case, post back if you learn anything new about the cause.