How to work with Colour Lists (ComboBox, Style 4)?

Started by Peter2, October 31, 2016, 03:24:29 AM

Previous topic - Next topic

Peter2

For me, it is a little bit confusing to work with colour list?

The basic problem is the communication between the (return values) of the combobox and the usage in AutoCAD.

Examples:
a) The German version returns "VonLayer" and "VonBlock" - how to use it in international version?
b) For color seven is returns "Schwarz" (Black), but "Cecolor" only accepts "Weiss" (White)
c) For higher values, it returns "Farbe 56", but Cecolor only accepts "56"
d) If I have higher values, "dcl-ComboBox-SelectString" does not find an entry for "Farbe 56" (because it is taken from the color-table and not from the list ...)


Are there any panaceas to handle it in a simple way? (first prio for point d)

Peter
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

roy_043

a: VonLayer/ByLayer=256, VonBlock/ByBlock=0.
Using the ENU version:
b: Color 7 is  "White".
c: Only the color number is displayed "56".
d: (dcl-ComboBox-SelectString) works with "56".

Peter2

Hi

I want to continue the topic.

I have a combo-box with "style 4 / Colors"; this is my defun

Code (autolisp) Select
(defun c:markierung/mpark_SN/Farbwahl#OnSelChanged (ItemIndexOrCount Value /)
    (princ "\nValue: ")
    (princ (setq mrk_parkplatz_sn_farbe value))
    (princ "\nItemindexorcount: ")
    (princ (setq mrk_parkplatz_sn_farbe_ind ItemIndexOrCount))
)


And this is my result, clicking through the list and the ACAD-Colordialogue:
Code (autolisp) Select
Value: VonLayer
Itemindexorcount: 0

Value: VonBlock
Itemindexorcount: 1

Value: Rot
Itemindexorcount: 2

Value: Gelb
Itemindexorcount: 3

Value: Grün
Itemindexorcount: 4

Value: Cyan
Itemindexorcount: 5

Value: Blau
Itemindexorcount: 6

Value: Magenta
Itemindexorcount: 7

Value: Weiß
Itemindexorcount: 8

Value: Farbe 50
Itemindexorcount: 0

Value: Farbe 9
Itemindexorcount: 0

Value: VonLayer
Itemindexorcount: 2

Value: Farbe 221
Itemindexorcount: 0

So if I want to set "cecolor" with

  • usage of the standard colors, I could use the "values" (strings) in German version, but have to translate it for other languages
  • the Indexnumber have to be changed from "2 to 1" (red), "3 to 2" for yellow ... Higher color-numbers don't return an index
  • the "values" (strings) of higher numbers contain the string "Farbe ", which have to be removed before passed to cecolor
  • VonLayer (Bylayer) returns index 0 when selected in the combo-box, but returns Index 2 when selected from the Acad-ACI-Colrtable
I suppose that I'm on the wrong way and it is more easier to handle - but how?
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

marcoheuer

hello peter,
try the following
Code (autolisp) Select
(dcl-ComboBox-GetItemData <CONTROL> intItemIndex [als Long])
or
Code (autolisp) Select
(dcl-ComboBox-GetItemData <CONTROL> (dcl-ComboBox-GetCurSel  <CONTROL> ))

best regards
marco
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

Peter2

(Strange, I got no notification for your reply)

Thanks, I will try.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10