本文整理汇总了C++中CDXUTDialog::GetUserData方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTDialog::GetUserData方法的具体用法?C++ CDXUTDialog::GetUserData怎么用?C++ CDXUTDialog::GetUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTDialog
的用法示例。
在下文中一共展示了CDXUTDialog::GetUserData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gOnUIPageEvent
//==================================================================================
void CALLBACK gOnUIPageEvent( UINT nEvent, NxI32 nControlID, CDXUTControl* pControl )
{
CDXUTDialog *dialog = pControl->m_pDialog;
void *userdata = dialog->GetUserData();
if ( userdata )
{
TuiElement *page = (TuiElement *) userdata;
TextUserInterface *tui = gTui;
if ( page )
{
TuiElement *ret = page->GetElement( nControlID-1 );
switch ( ret->GetType() )
{
case TT_MULTI_SELECT:
{
switch( nEvent )
{
case EVENT_LISTBOX_ITEM_DBLCLK:
{
//DXUTListBoxItem *pItem = ((CDXUTListBox *)pControl)->GetItem( ((CDXUTListBox *)pControl)->GetSelectedIndex( -1 ) );
break;
}
case EVENT_LISTBOX_SELECTION:
{
CDXUTListBox *pListBox = (CDXUTListBox *)pControl;
TuiChoiceVector &choices = ret->GetChoices();
NxI32 count = (NxI32)choices.size();
for (NxI32 i=0; i<count; i++)
{
DXUTListBoxItem *item = pListBox->GetItem(i);
TuiChoice &choice = choices[i];
assert(item);
if ( item )
{
if ( choice.GetState() != item->bSelected )
{
choice.SetState(item->bSelected);
const char *args[2];
args[0] = choice.GetArg().Get();
if ( choice.GetState() )
args[1] = "true";
else
args[1] = "false";
page->ExecuteElement( nControlID-1, 2, args, tui, false );
}
}
}
}
}
}
break;
case TT_SLIDER:
{
CDXUTSlider *slider = (CDXUTSlider *) pControl;
NxI32 v = slider->GetValue();
NxF32 fv = ret->GetSliderValue(v);
char scratch[512];
sprintf(scratch,"%0.3f", fv );
const char *args[1];
args[0] = scratch;
page->ExecuteElement( nControlID-1, 1, args, tui, false );
}
break;
case TT_COMBO:
{
CDXUTComboBox *combo = (CDXUTComboBox *) pControl;
DXUTComboBoxItem *pItem = combo->GetSelectedItem();
wchar_t *string = pItem->strText;
char scratch[512];
wcstombs(scratch, string, 512 );
const char *args[1];
args[0] = scratch;
page->ExecuteElement( nControlID-1, 1, args,tui, false );
// now, do we need to hide any items (or show them)?
page->OnComboBoxChange( scratch, nControlID-1 );
}
break;
case TT_BUTTON:
case TT_PAGE:
page->ExecuteElement( nControlID-1, 0, 0, tui, false );
break;
case TT_CHECKBOX:
{
CDXUTCheckBox *pCheck = (CDXUTCheckBox *)pControl;
bool state = pCheck->GetChecked();
const char *args[1];
if ( state )
{
args[0] = "true";
}
else
//.........这里部分代码省略.........