Started by Peter2 ·
2013-09-23 18:17 UTC ·
11 replies · SMF topic #2031
Peter2
2013-09-23 18:17 UTC
from the sample "misc.adcl" I used the combobox with the colors and wrote this function:
(defun c:Verdrahtung_opt_verdrahtung_combox_farben_OnSelChanged (ItemIndexOrCount Value /)
(if (not (dcl_Form_IsApplyEnabled Verdrahtung_opt_verdrahtung))
(dcl_Form_SetApplyEnabled Verdrahtung_opt_verdrahtung T)
)
(setq freistellfarbe_temp Value)
)
a)
At first I tried to use "ItemIndexOrCount", and it worked fine for the standard colors (up to 9). Using one of the color dialogues just displayed the right value in the combobox (e.g. "Color 183"), but the return-value "ItemIndexOrCount" was always 0. What went wrong?
b)
Then I used the "Value" and get the names of the colors: red, green, color 183, ...
Using DXF-code (entmod) I need the numbers of the colors, and so I have to "convert" them from string to real: red -> 1, green -> 3.
That's not impossible, but working in a multi-language environment it could be a problem ...
Conclusion:
How do I get the color-number from the color-combobox?
roy_043
2013-09-23 18:53 UTC
A. Nothing is going wrong. The index is not the ACI index but the list index.
B. I don't know a way around this.
Peter2
2013-09-23 19:05 UTC
author=roy_043 link=topic=2031.msg10021#msg10021 date=1379962389 wrote:
A. Nothing is going wrong. The index is not the ACI index but the list index....
But when I select "Color 183" which is displayed in the list - why I do not get "184" as list index? I get 0 ...
owenwengerd
2013-09-23 19:28 UTC
author=Peter2 link=topic=2031.msg10022#msg10022 date=1379963103 wrote:
But when I select "Color 183" which is displayed in the list - why I do not get "184" as list index? I get 0 ...
Do I understand correctly that you first add Color 183 to the list, then select it? When I tried that, Color 183 was added at the beginning of the list, which is index 0. Therefore, 0 would be the correct list index in that case.
I think that
{2} will return the ACI color value associated with a color combo box list item.
Peter2
2013-09-23 19:36 UTC
author=owenwengerd link=topic=2031.msg10025#msg10025 date=1379964536 wrote:
Do I understand correctly that you first add Color 183 to the list, then select it? .....
No. I (my code) add nothing to the list. I have the "Combobox - Type 4 - Colors" which is created by ODCL. But I don't know how the list of colors is created - maybe the base-list has only the standard colors and all others are added while the user picks a color from the color-dialogues?
owenwengerd
2013-09-23 19:45 UTC
author=Peter2 link=topic=2031.msg10026#msg10026 date=1379964968 wrote:
But I don't know how the list of colors is created - maybe the base-list has only the standard colors and all others are added while the user picks a color from the color-dialogues?
Yes, and the list of added colors is stored in the current user profile.
Peter2
2013-09-23 20:02 UTC
author=owenwengerd link=topic=2031.msg10025#msg10025 date=1379964536 wrote:
....When I tried that, Color 183 was added at the beginning of the list, which is index 0. Therefore, 0 would be the correct list index in that case....
The list consists always of "1 special color (index 0) plus following standard colors"?
author=owenwengerd link=topic=2031.msg10025#msg10025 date=1379964536 wrote:
I think that {2} will return the ACI color value associated with a color combo box list item.
I think I tried it already but I will try again on Wednesday.
author=owenwengerd link=topic=2031.msg10027#msg10027 date=1379965550 wrote:
Yes, and the list of added colors is stored in the current user profile.
Where? If I repeat the job and select some colors then I can see only the current selected color. It does not makes a history which stores formerly selected colors.
owenwengerd
2013-09-23 20:21 UTC
Maybe this will help:
{2}
{2}
Peter2
2013-09-23 20:34 UTC
Thank you. I will continue the day after tomorrow.
roy_043
2013-09-24 07:39 UTC
author=Peter2 link=topic=2031.msg10028#msg10028 date=1379966539 wrote:
The list consists always of "1 special color (index 0) plus following standard colors"?
No. The special color 156 is added by Misc.lsp. The default list starts with "ByLayer".
author=owenwengerd link=topic=2031.msg10027#msg10027 date=1379965550 wrote:
Yes, and the list of added colors is stored in the current user profile.
This does not happen (at least not with BricsCAD).
owenwengerd
2013-09-24 15:18 UTC
author=roy_043 link=topic=2031.msg10031#msg10031 date=1380008348 wrote:
This does not happen (at least not with BricsCAD).
I stand corrected.
Peter2
2013-09-25 07:40 UTC
author=owenwengerd link=topic=2031.msg10025#msg10025 date=1379964536 wrote:
I think that {2} will return the ACI color value associated with a color combo box list item.
Thank you. Confirmed - Solved.