Table of Contents

Class PmpListBox

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

Allows you to access a PropertyManager page list box control.

public class PmpListBox : PmpTextBase<PropertyManagerPageListbox>, IWrapSolidworksObject<PropertyManagerPageListbox>, IReleaseSolidworksObject
Inheritance
PmpControl<PropertyManagerPageListbox>
PmpTextBase<PropertyManagerPageListbox>
PmpListBox
Implements
IWrapSolidworksObject<PropertyManagerPageListbox>
Inherited Members

Constructors

PmpListBox(string[], string, string, short, ListboxStyles)

make a list box in a property manager page

public PmpListBox(string[] items, string caption, string tip, short height = 0, ListboxStyles style = ListboxStyles.SortAlphabetically)

Parameters

items string[]

items to add to this list box

caption string

caption for this list box

tip string

tooltip text for this list box

height short

0 Default height with no scrolling
< 30 Specified height and no scrolling

30 Specified height and scrolling, but no auto sizing

style ListboxStyles

style of this list box as defined in bitwise ListboxStyles

Properties

CurrentSelection

Gets and sets the item that is currently selected in this list box.

public short? CurrentSelection { get; set; }

Property Value

short?

Index number of the item in the 0-based list

Remarks

If you use this property with a list box enabled for multiple selections, then this method returns -1 and does not affect the list box.

ItemCount

Gets the number of items in the attached drop-down list for this list box.

public int? ItemCount { get; }

Property Value

int?

Style

get or set style as defined in ListboxStyles

public int Style { get; set; }

Property Value

int

Remarks

By default, only one list item can be selected at a time. When another list item is selected, that item becomes the active item and the previously selected item is cleared.

Methods

AddItems(string[])

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

public void AddItems(string[] items)

Parameters

items string[]

Clear()

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

public void Clear()

DeleteItem(short)

Removes the specified item from the attached drop-down list for this list box.

public short? DeleteItem(short item)

Parameters

item short

Index number of the item to delete from the 0-based list of items

Returns

short?

Number of items remaining in the list or -1 if the item is not deleted

GetSelectedItems()

Gets the items selected in a list box enabled for multiple selections.

public object GetSelectedItems()

Returns

object

Array of 0-based index shorts of the currently selected items in this list box

GetSelectedItemsCount()

Gets the number of items currently selected in a list box enabled for multiple selection.

public int? GetSelectedItemsCount()

Returns

int?

Number of items currently selected in this list box

InsertItem(short, string)

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

public short? InsertItem(short Item, string Text)

Parameters

Item short

Position where to add the item in the 0-based list or -1 to put the item at the end of the list

Text string

Text for item

Returns

short?

Position in the 0-based list where the item is added or -1 if the item is not added to the list

ItemText(short)

Gets the text for the specified item in this list box.

public string ItemText(short Item)

Parameters

Item short

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

Returns

string

SetSelectedItem(short, bool)

Sets whether an item is selected or cleared in a list box enabled for multiple selection.

public bool? SetSelectedItem(short Item, bool Selected)

Parameters

Item short

Index of the item to select or clear

Selected bool

True to select the item, false to not

Returns

bool?

True if the item was selected or cleared, false if not

Remarks

The value specified for Item must be a valid index number. If it is not, then this method returns false. Thus, set up your list item index before using this method.

If you use this method to set a selected item in a single-selection style list box and another item in the list box is already selected, then that item is automatically cleared.
You can use this method to clear a selection in a single-selection style list box, which results in no current selection in that list box.

UnsubscribeFromEvents()

Unsubscribes all event handlers from events fired by this control.

public override void UnsubscribeFromEvents()

Events

Displaying

will be fired a moment before this Listbox is displayed in a property manager page.

public event EventHandler<PmpListboxDisplayingEventArgs> Displaying

Event Type

EventHandler<PmpListboxDisplayingEventArgs>

RightClicked

Called when the right-mouse button is released in a list box on this PropertyManager page.

public event EventHandler<Tuple<double, double, double>> RightClicked

Event Type

EventHandler<Tuple<double, double, double>>

SelectionChanged

Called when a user changes the selected item in a list box or selection list box on this PropertyManager page.
solidworks will pass in the id of item

public event EventHandler<int> SelectionChanged

Event Type

EventHandler<int>