Color Combo: Problems and Questions

Started by roy_043, July 11, 2011, 12:17:25 PM

Previous topic - Next topic

roy_043

Hello,

Here are some problems and questions regarding the Color ComboBox.

System:
Bricscad 11.4.2
Windows XP
OpenDCL 6.0.2.4

Files:
ColorComboTest.lsp
ColorComboTest.odcl
ColorComboTest_mouse_over_effect.gif

1.
Selecting a "Windows..." color returns the same values as selecting "ByBlock".

2.
Why not use (or: is there a way to use):
Code (autolisp) Select
(acad_truecolordlg '(62 . 1) nil)
instead of the Windows' color dialog?

3.
After multiple clicks on 'normal' colors, the list displays multiple entries of the "Select color..." item with a strange 'mouse-over-effect'. See image.

4.
After exiting the dialog and a restart of the COLTEST program, executing this code:
Code (autolisp) Select
(dcl_ComboBox_DeleteItem ColorComboTest_ColComboModeless_ComboBox1 0)
multiple times until the return value is nil, or executing this code:
Code (autolisp) Select
(dcl_ComboBox_Clear ColorComboTest_ColComboModeless_ComboBox1)
results in a list that still has two entries: "Select color..." and "Windows...". How can they be removed?

5.
Continuing after 4. (list is empty except for the "Select color..." and "Windows..." entries) pasting this code on the command line:
Code (autolisp) Select
(dcl_ComboBox_AddColor ColorComboTest_ColComboModeless_ComboBox1 5)
results in a list starting with "blue" (no cap) followed by all the standard entries including a second "Blue" entry (with a cap). Is there a way to create a list with, for instance, just colors 251, 252, 253 and 254?

6.
After exiting the dialog and a restart of the COLTEST program, executing this code:
Code (autolisp) Select
(dcl_ComboBox_AddColor ColorComboTest_ColComboModeless_ComboBox1 11)
will add color 11 to the top of the list. Why is it not below "white"? Note:
Code (autolisp) Select
(dcl_Control_GetSorted ColorComboTest_ColComboModeless_ComboBox1) ; => T

7.
After exiting the dialog and a restart of the COLTEST program, executing this code:
Code (autolisp) Select
(dcl_Control_GetText ColorComboTest_ColComboModeless_ComboBox1)
returns "3". After 'manually' selecting red the same code returns "Red".

Regards, Roy.

Fred Tomke

#1
Hi, roy_043,

my feeling is that the colorcombo is for ACI color only. If you choose a truecolor from the Windows System Color box, the corresponding ACI color index will be added to the color combo. Maybe it's a bug. But I don't believe that because the FindColor and the AddColor methods are only supporting ACI colors.

1. I cannot reproduce this: GetItemData will return the right ACI color index.

2. As I mentioned, my feeling is that it should only support ACI color index. Using the Windows System Color form has its historical reason to keep ObjectDCL compatibel between AutoCAD 2002 and 2004. I'm not sure how much Owen has changed in the color combo meanwhile.

3. I cannot reproduce this on Map 2012 x64. After 20 clicks on ACI colors 1 to 7 nor more entries were added.

4. I got never nil when using (dcl_ComboBox_DeleteItem ColorComboTest_ColComboModeless_ComboBox1 0) several times.

5. As far as I know it cannot be removed because it belongs to the color combo. Otherwise create an imagecombo. :)
I can reproduce the behavior of addind the additional item in the list. It seems that after a Clear a new initialization of the combobox will be started so the control does not know that it already contains color blue. In the German language version I have the Color 'Blau' and the color 'Farbe 5'. When you have a try with AddColor 5 without a Clear before you will see that color 5 won't be added again.

6. Do you see the line on top of ByLayer item? That means that all the color which are displayed above this line are recently selected colors. Sorting property is for textitems in the combobox, not for colors.

7. (dcl_Control_GetText ColorComboTest_ColComboModeless_ComboBox1) is not a good way to read out the value of the textbox. Please have a look at GetEBText and GetLBText. That means that you just have to get the selected item at first using GetCursel to get the item text using GetLBtext. GetEBText is for editable comboboxes only.

As an OpenDCL user I recommend you to create an empty slide or an empty picture box to show the selected color. Clicking on this item will call acad_truecolordlg as you mentioned. It’s much easier than the color combo and it takes the user much less clicks to select a different color.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

owenwengerd

To add to what Fred said, the color dialog is implemented by the host application, so the errant behavior in Bricscad is due to bugs in Bricsys' implementation. I recommend to report the problem(s) to them via a support request. You can point them to this thread.
Owen Wengerd (Outside The Box) / ManuSoft

roy_043

Fred and Owen thank you for your time and patience. I will submit a support request and try using an imagecombo as an alternative.

Fred Tomke

Hi, roy, the disadvantage of the imagecombo is that you cannot display all of the 16777216 colors of RGB as images. That's why I use the slide / imagecombobox.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

roy_043

I have changed the program to use an ImageCombo. Some new problems popped up. Since these are unrelated to the color Combo discussion in this topic I have started a new one:
http://www.opendcl.com/forum/index.php?topic=1656.0

@ Fred: what do you mean by 'slide / imagecombobox'? It seems you can't use a slide in an ImageCombo.

Fred Tomke

Hi, roy_043,

no you can't use a slide in a combo. But you can use a slide or a picturebox as a "colorbutton" which shows the color you've selected.

I've added an example.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

roy_043

Fred, thank you for sharing. I'll be dissecting your code this week.