Adding Items to a Layer Combo Box

Started by awybo, April 11, 2014, 06:59:01 AM

Previous topic - Next topic

awybo

Hi guys,

I'm wondering if there is a way to add an entry to a layer combo box (a combo box whose style is 13).

The addlist and addstring methods don't seem to work on a "layer-styled" combobox (which may be intentional?).

Here is why I want to do this:

The built in layer-styled combobox works great but I would like to add in one more item which will be something like "Current". This is part of a configuration menu for a module and if "Current" is selected then later in the code the program will use whatever layer is current when it needs a target layer.

Maybe you have some insight on a better way to do this or have done something similar in the past?

Fred Tomke

Have you already tested dcl-ComboBox-AddString method?
Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

owenwengerd

The current implementation is designed to keep the combo contents synchronized with the layers in the active drawing. I have an idea though, and will look at how AddString could be supported.

awybo

Yep, I tested dcl_ComboBox_AddString and dcl_ComboBox_AddList. I use these two methods elsewhere for non layer-type combo box and they work great. It is only with the layer-type combo box that they don't seem to have any effect. Thanks for looking into this.

Kerry

Quote from: owenwengerd on April 11, 2014, 07:23:23 AM
The current implementation is designed to keep the combo contents synchronized with the layers in the active drawing. I have an idea though, and will look at how AddString could be supported.

Any joy with this Owen, I'd really like to have control over the layer names that are displayed.
ie : pass a filtered list of names to the control and only have those display.
Perfection is not optional.
My other home is TheSwamp

owenwengerd

Quote from: Kerry on June 10, 2016, 01:14:02 AM
Any joy with this Owen, I'd really like to have control over the layer names that are displayed.
ie : pass a filtered list of names to the control and only have those display.

I haven't had time to test, but I'm pretty sure you can now add items to the list, and these are preserved when the list is repopulated. I'm not so sure about deleting items. I guess you probably can delete items, but I'm not sure how complicated it is to keep the unwanted items out as the list is automatically repopulated on document activation changes or changes in the active document layer table.