Table of Contents

Class PmpComboBox

Namespace
Hymma.Solidworks.Addins
Assembly
Hymma.Solidworks.Addins.dll

a combo box with multiple text values

public class PmpComboBox : PmpControl<PropertyManagerPageCombobox>, IWrapSolidworksObject<PropertyManagerPageCombobox>, IReleaseSolidworksObject
Inheritance
PmpControl<PropertyManagerPageCombobox>
PmpComboBox
Implements
IWrapSolidworksObject<PropertyManagerPageCombobox>
Inherited Members

Constructors

PmpComboBox(List<string>, ComboBoxStyles, short)

create combo box for property manager page

public PmpComboBox(List<string> items, ComboBoxStyles style, short height = 50)

Parameters

items List<string>

list of items in the combo box

style ComboBoxStyles

style of the combo box as defined by ComboBoxStyles

height short

height of the combo box

Properties

CurrentSelection

Gets and sets the item that is currently selected for this combo box.

public short CurrentSelection { get; set; }

Property Value

short

Remarks

0-based index

EditText

Gets or sets the text in the combo box.

public string EditText { get; set; }

Property Value

string

Height

height of the combo box

public short Height { get; set; }

Property Value

short

Items

items in the combo-box the index of these items is not the same as SolidWORKS UI and is not reliable

public ReadOnlyCollection<string> Items { get; }

Property Value

ReadOnlyCollection<string>

Style

gets or sets the style for the attached drop down list for this combo-box

public ComboBoxStyles Style { get; set; }

Property Value

ComboBoxStyles

Combo-box style as defined in ComboBoxStyles

Remarks

Style is a combination of Boolean values, each represented by a bit in this long value. The different Boolean values are represented in the swPropMgrPageComboBoxStyle_e enumeration.
For example, to set the attached drop-down list of a combo box so that the items are sorted, set Style to Sorted.

The control style must be set before the PropertyManager page is displayed except if setting Style EditBoxReadOnly. You can set style either before or after the PropertyManager page is displayed.

Methods

AddItem(string)

Inserts an item in the attached drop-down list of this combo box.

public void AddItem(string item)

Parameters

item string

item to add

AddItems(IEnumerable<string>)

Adds items to the attached drop-down list for this combo box.

public void AddItems(IEnumerable<string> items)

Parameters

items IEnumerable<string>

Clear()

Clears all items from the attached drop-down list for this combo box.

public void Clear()

Contains(string)

indicates if an item is in the list

public bool Contains(string item)

Parameters

item string

Returns

bool

Delete(short)

deletes an item from the attached drop-down list for this combo box

public void Delete(short index)

Parameters

index short

GetItem(short)

Gets the text from the attached drop-down list for this combo box.

public string GetItem(short index)

Parameters

index short

Position of the item where to get the text in the 0-based list of items or -1 to get the text of the currently selected item

Returns

string

text of the specified item

UnsubscribeFromEvents()

Unsubscribes all event handlers from events

public override void UnsubscribeFromEvents()

Events

EditChanged

Called when a user changes the text string in the text box of a combo box on this PropertyManager page. SolidWORKS will pass in the text string

public event EventHandler<string> EditChanged

Event Type

EventHandler<string>

Remarks

This method is only called if the combo box was set up as an editable text box. If the combo box is set up to as a static text box, then this method is not called.

If the user can edit the text in the text box, then use this method with SelectionChanged to find out what is in the text box of the combo box.

When this method is called, the control may not yet be updated with the current selection, so the CurrentSelection property is not reliable. The text passed into this method is the up-to-date text.

SelectionChanged

Called when a user changes the selected item in a combo box on this PropertyManager page.

public event EventHandler<int> SelectionChanged

Event Type

EventHandler<int>

Remarks

SolidWORKS will pass int the id of the selected item