1 NX9+VS2012 2 3 public: 4 5 void SetBlockUIShow(); 6 7 8 void EnumInt::SetBlockUIShow() 9 { 10 //獲取枚舉控件 11 PropertyList* EnumProps = enum0->GetProperties(); 12 int EnumValue = EnumProps->GetEnum("Value"); 13 delete EnumProps; 14 EnumProps = NULL; 15 16 //得到ini類型值 17 //條件判斷,當枚舉為下拉第一個時顯示哪些控件 18 if ( EnumValue == 0 ) 19 { 20 face_select0->SetShow(true); 21 bodySelect0->SetShow(false); 22 } 23 else 24 { 25 face_select0->SetShow(false); 26 bodySelect0->SetShow(true); 27 } 28 } 29 //使用方法 30 將自己寫的函數SetBlockUIShow();加到如下地方: 31 1.dialogShow里 32 void EnumInt::dialogShown_cb() 33 { 34 try 35 { 36 //---- Enter your callback code here ----- 37 38 SetBlockUIShow();//此處 39 40 } 41 catch(exception& ex) 42 { 43 //---- Enter your exception handling code here ----- 44 EnumInt::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what()); 45 } 46 } 47 48 2.update_cb里的枚舉控件下 49 int EnumInt::update_cb(NXOpen::BlockStyler::UIBlock* block) 50 { 51 try 52 { 53 if(block == enum0) 54 { 55 //---------Enter your code here----------- 56 57 SetBlockUIShow();//此處 58 59 }
1 //設置名字 2 enum0->SetLabel("選擇"); 3 4 //設置控件變灰色 5 enum0->SetEnable(false); 6 7 8 //設置控件是否顯示 9 enum0->SetShow(true);
//獲取枚舉控件,當前選擇的名稱
NXString EnumName = EnumProps->GetEnumAsString("Value");
uc1601(EnumName.GetLocaleText(), 1);
補充 20020年4月27日
設置枚舉下拉內容 vector<NXString> AA; AA.push_back("1"); AA.push_back("2"); AA.push_back("3"); enumOneName->SetEnumMembers(AA);
Caesar盧尚宇