NX二次开发-Block UI C++界面Enumeration(枚举)控件的获取(持续补充)

NX9+VS2012

public:

	void SetBlockUIShow();


void EnumInt::SetBlockUIShow()
{
	//获取枚举控件
	PropertyList*  EnumProps = enum0->GetProperties();
	int EnumValue = EnumProps->GetEnum("Value");
	delete EnumProps;
	EnumProps = NULL;

//得到ini类型值
//条件判断,当枚举为下拉第一个时显示哪些控件
	if ( EnumValue == 0 )
	{
		face_select0->SetShow(true);
		bodySelect0->SetShow(false);
	}
	else
	{
		face_select0->SetShow(false);
		bodySelect0->SetShow(true);
	}
}
//使用方法
将自己写的函数SetBlockUIShow();加到如下地方:
1.dialogShow里
void EnumInt::dialogShown_cb()
{
    try
    {
        //---- Enter your callback code here -----

	SetBlockUIShow();//此处

    }
catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        EnumInt::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
}

2.update_cb里的枚举控件下
int EnumInt::update_cb(NXOpen::BlockStyler::UIBlock* block)
{
    try
    {
        if(block == enum0)
        {
        //---------Enter your code here-----------

		SetBlockUIShow();//此处

    }

2018年11月25日
Caesar卢尚宇
[email protected]

在这里插入图片描述

//设置名字
enum0->SetLabel("选择");

//设置控件变灰色
enum0->SetEnable(false);


//设置控件是否显示
enum0->SetShow(true);

2018年11月25日
Caesar卢尚宇
[email protected]

猜你喜欢

转载自blog.csdn.net/lu1287580078/article/details/84501517
今日推荐