fill a combo box list

Started by bowlingpin1, March 14, 2013, 01:47:22 PM

Previous topic - Next topic

bowlingpin1

Good day,

I am new to Lisp in general, let alone the Active X stuff.

I am trying to build a palette that will take info from Autocad and convert it for another program.  The output will be a CIX file or a txt file, that isn't to important at this point.

The combo box will be used to select a layer.
The list box will display all entities on that layer.
You would then select each item in the list box and select with the radio buttons if it is fixed or parametric.
I'll have to set one pair for the start point and another for the end point.

So I'll start with my first problem and hopefully I'll be able to work along from there.  I can't get the combo box to list the layers. I found some code from another site ( http://www.jtbworld.com/lisp/layer-list.htm ) and edited it a lot.  The result is that if you just run the AX code, alone and not in the palette,you get a variable that is a list of all the layers.  I thought I could then use that list to populate the combo box.

Attahced:
BWPC.odcl <- the palette
BWPC <- the lsp file
Layerfinderv2 <- the code that searches and returns layers, alone, returns lstwhole which is a list of the layers

I am hoping to tackle this one step at a time.  Understand please I am a cabinet maker that is pretty good with computers, not coding.

Have a nice evening  :)

roy_043

There is a _MasterDemo.lsp that comes with the OpenDCL program. Among many other things it contains a sample of a layers combobox. Seems like a good starting point.
Start _MasterDemo.lsp > On the Basic tab click the Misc button > Go to the Comboboxes1 tab.

bowlingpin1

quite helpful thanks :) (no sarcasm)

owenwengerd

#3
Quote from: bowlingpin1 on March 14, 2013, 01:47:22 PM
I thought I could then use that list to populate the combo box.

You would want to populate the combo in OnInitialize instead of OnDropdown (and remove the "NewItems" that doesn't belong), then your code should work the way you want. As roy said, you may as well use the built in layer combo.

bowlingpin1

How do I read what is set in the combo box?  I need to set the layer name to a variable to ultimately populate a list box with all the entities on said layer.

I seem to be going around in circles :P

bowlingpin1

I am guessing use:

(dcl_ListBox_AddList BWPC_BWpara_ListBox1 NewItems [as List of Strings])

and I have to create a function that will find all the entities on the layer and turn them into a string?

then after that I guess I have to figure out how to read the list box, create a bunch of variables based on each item and create a list from that?

roy_043

It makes most sense to use the SelChanged event for that. Alternatively you can use the dcl_ComboBox_GetCurSel function.
To use the SelChanged event just click on the Events tab of the control, check this event and paste the example function in your code. When the event is triggered the function will be called and the ItemIndexOrCount and Value arguments will be set to useful data.

bowlingpin1

Quote from: roy_043 on March 17, 2013, 08:43:03 AM
It makes most sense to use the SelChanged event for that. Alternatively you can use the dcl_ComboBox_GetCurSel function.
To use the SelChanged event just click on the Events tab of the control, check this event and paste the example function in your code. When the event is triggered the function will be called and the ItemIndexOrCount and Value arguments will be set to useful data.

Okay so now I can read the combo box :)  I use ssget and a filter to get a selection set of all entities on the layer chosen, but it returns <selection set: 100> or some such thing, sometimes <selection set: e5> .  how do I convert the selection to a list?  could I then use mapchar to convert that list to a list of strings?  As right now the return is just saying it is selected, I need what it got, not a result of what it said it got(if that makes sense).

Here is an updated version of my efforts.  Am I being to needy on these forums?

owenwengerd

Your questions are fine, but you'll get quicker (and more) general lisp help over at the swamp. I recommend to post your general lisp questions there, and OpenDCL specific questions here (or here).