SDK:Working with VWListBoxCtrl

From Vectorworks Developer
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

.SDK|SDK ..SDK:Types|SDK Types ..SDK:Using the SDK|Using the SDK ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

Initializing of the control

The initialization of the control is done in OnSetUpEvent:

void CSampleDlg::OnSetUpEvent()
{
	VWDialog::OnSetUpEvent();

	VWListBoxCtrl*  pListBox  = this->GetListBoxCtrlByID( kMyListBox );

	pListBox->AddItem( "item1" );
	pListBox->AddItem( "item2" );
}

Settings markers to the items

You can assign marker value to each element in the list. This helps managing dynamicly changed lists.

The simplest example is making a list for enumerations, but having dynamic sub set of the enumeration as items in the list:

enum EMyValues {
  kMyValues_One,
  kMyValues_Two,
  kMyValues_Three
  kMyValues_Four,
}

pListBox->AddItem( "item1", size_t(-1), kMyValues_One );
pListBox->AddItem( "item3", size_t(-1), kMyValues_Three );

EMyValues myValue = ...;

// select appropreate item
// Actually the enumeration value is used
pListBox->SelectItemWithMarker( myValue );

Then, we could easily map backward from the selection index to enumeration value:

EMyValues myValue = (EMyvalues) pListBox->GetSelectedItemMarker();

See Also

SDK:Creating handler class for VectorScript layout dialog | SDK:Creating handler class for manual layout dialog | SDK:Working with Dynamic Data Exchange (DDX) |