SDK:Working with VWPullDownMenuCtrl: Difference between revisions
Jump to navigation
Jump to search
(New page: <div class="rightmenu"> __TOC__ </div> == Initializing of the control == The initialization of the control is done in <i>OnSetUpEvent</i>: <code lang="cpp"> void CSampleDlg::OnSetUpEvent...) |
m (1 revision) |
(No difference)
|
Revision as of 15:39, 12 August 2013
.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(); VWPullDownMenuCtrl* pPopupCtrl = this->GetPullDownMenuCtrlByID( kMyListBox ); pPopupCtrl->AddItem( "item1" ); pPopupCtrl->AddItem( "item2" ); }
Settings markers to the items
You can assign marker value to each element in the popup list. This helps managing dynamicly changed popup lists.
The simplest example is making a popup list for enumerations, but having dynamic sub set of the enumeration as items in the popup list:
enum EMyValues { kMyValues_One, kMyValues_Two, kMyValues_Three kMyValues_Four, } pPopupCtrl->AddItem( "item1", size_t(-1), kMyValues_One ); pPopupCtrl->AddItem( "item3", size_t(-1), kMyValues_Three ); EMyValues myValue = ...; // select appropreate item // Actually the enumeration value is used pPopupCtrl->SelectItemWithMarker( myValue );
Then, we could easily map backward from the selection index to enumeration value:
EMyValues myValue = (EMyvalues) pPopupCtrl->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) |