OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Peter2 on October 31, 2016, 03:24:29 AM

Title: How to work with Colour Lists (ComboBox, Style 4)?
Post by: Peter2 on October 31, 2016, 03:24:29 AM
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
Title: Re: How to work with Colour Lists (ComboBox, Style 4)?
Post by: roy_043 on October 31, 2016, 09:00:48 AM
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".
Title: Re: How to work with Colour Lists (ComboBox, Style 4)?
Post by: Peter2 on November 17, 2016, 01:31:50 PM
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
I suppose that I'm on the wrong way and it is more easier to handle - but how?
Title: Re: How to work with Colour Lists (ComboBox, Style 4)?
Post by: marcoheuer on November 17, 2016, 10:39:16 PM
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
Title: Re: How to work with Colour Lists (ComboBox, Style 4)?
Post by: Peter2 on November 20, 2016, 03:14:05 AM
(Strange, I got no notification for your reply)

Thanks, I will try.