ComboBox - Color

Started by Kerry, August 03, 2008, 09:48:20 PM

Previous topic - Next topic

Kerry


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.
Perfection is not optional.
My other home is TheSwamp

Kerry



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)
    )
)
;;;----------------------------------------------------------------------------
Perfection is not optional.
My other home is TheSwamp

owenwengerd

I didn't notice any problems in a quick test. Are you sure you're adding the color before you try to select it?

Kerry


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

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

Perfection is not optional.
My other home is TheSwamp

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kerry


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

Perfection is not optional.
My other home is TheSwamp