OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Kerry on August 03, 2008, 09:48:20 PM

Title: ComboBox - Color
Post by: Kerry on August 03, 2008, 09:48:20 PM

With the ComboBox type set to 4 - Color

Has anyone been able to programmatically set the selection to any Color number above White

(dcl_ComboBox_SetCurSel KDUB_Test080804_Main_Combo3DColor 2) ;works
(dcl_combobox_selectstring KDUB_Test080804_Main_Combo3DColor "Magenta") ;works

(dcl_ComboBox_SetCurSel KDUB_Test080804_Main_Combo3DColor 200) ; is ignored
(dcl_combobox_selectstring KDUB_Test080804_Main_Combo3DColor "Color 100")  ; is ignored


(cons "pf:3DColor"  (dcl_ComboBox_GetTBText KDUB_Test080804_Main_Combo3DColor)) returns ("pf:3DColor" . "Color 193") as expected


I'm not sure if I've missed something or if this is a bug.
Title: Re: ComboBox - Color
Post by: Kerry on August 03, 2008, 09:52:52 PM


and just for info , I've found this to be handy ..

;;;----------------------------------------------------------------------------
;; Convert the return value from the dcl_ComboBox_GetTBText Method to a Color Number (1-255)
;; (_ConvertColorStringToNumber "12")
;; (_ConvertColorStringToNumber "Color 122")
;; (_ConvertColorStringToNumber "Cyan")
;;
(defun _ConvertColorStringToNumber (ColorString / tmp)
    (setq ColorString (vl-string-subst "" "Color " ColorString))
    (cond ((numberp (setq tmp (read ColorString))) tmp)
          ((numberp (setq tmp (eval (read (strcat "ac" ColorString))))) tmp)
          (t 8)
    )
)
;;;----------------------------------------------------------------------------
Title: Re: ComboBox - Color
Post by: owenwengerd on August 03, 2008, 10:53:09 PM
I didn't notice any problems in a quick test. Are you sure you're adding the color before you try to select it?
Title: Re: ComboBox - Color
Post by: Kerry on August 03, 2008, 11:13:51 PM

Not sure what you mean by add  the color ... ?

The Combo is pre-initialised with the colors by default.

Title: Re: ComboBox - Color
Post by: Fred Tomke on August 04, 2008, 12:23:28 AM
Hello Kerry,

if you show the form the first time and you drop down the color combo you see only a few colors (numbers 1 up to 7). The others ACI colors are not shown. If you want to select another color (ACI color number 200 for instance), you have to add the color first using AddColor method of dropdown control.

Fred
Title: Re: ComboBox - Color
Post by: Kerry on August 04, 2008, 07:20:55 PM

Ahhhhh ! .. thanks Fred. I understand. I'll play with that tonight.