//内部函数 设置选择过滤器的默认选择范围
void SEL_Set_Default_Scope(int scopeType) {
HMODULE ugui = LoadLibrary(L"libugui");
typedef void(*SEL_Set_Default_Scope_f_p_t)(int scope_type);
SEL_Set_Default_Scope_f_p_t SEL_set_default_scope = NULL;
SEL_set_default_scope = (SEL_Set_Default_Scope_f_p_t)GetProcAddress(ugui, "?SEL_set_default_scope@@YAXH@Z");
if (SEL_set_default_scope != NULL)
{
SEL_set_default_scope(scopeType);
}
FreeLibrary(ugui);
}
//构造函数中添加回调
theDialog->AddFocusNotifyHandler(make_callback(this, &testSetSelectionScope::focusNotify_cb));
//------------------------------------------------------------------------------
//Callback Name: focusNotify_cb
//This callback is executed when any block (except the ones which receive keyboard entry such as Integer block) receives focus.
//------------------------------------------------------------------------------
void testSetSelectionScope::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
{
try
{
if (block == selection0 && focus)
{
SEL_Set_Default_Scope(UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY);
//SEL_Set_Default_Scope(UF_UI_SEL_SCOPE_WORK_PART_AND_OCC);
//SEL_Set_Default_Scope(UF_UI_SEL_SCOPE_WORK_PART);
}
}
catch (exception& ex)
{
//---- Enter your exception handling code here -----
testSetSelectionScope::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
}
08-30
203
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-28
402
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-10
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交