快捷导航 上传作品

[c++] NX二次开发多按钮模态对话框C++源码就上UG网

[复制链接]
ug9.0发表于 2016-5-9 07:35:54 | 显示全部楼层 |阅读模式
就上UG网学UG二次开发:
多按钮对话框提供了多个按钮,但是其最多只能有三个供用户选择,程序可以根据用户不同的选择实现不同的分支功能,该对话框的使用函数为:UF_UI_message_dialog;

UG二次开发

UG二次开发

C++NX二次开发多按钮模态对话框源码:
    /* TODO: Add your application code here */

  1.     /*多按钮模态对话框*/
  2.    
  3.     int response = 0;//返回值
  4.    

  5.     char * title_string = "就上UG网";//对话框标题

  6.     char sug[132] = "学UG就上UG网,就上UG网学UG-www.9sug.com";
  7.     char * p = sug;

  8.     UF_UI_MESSAGE_DIALOG_TYPE dialog_type = UF_UI_MESSAGE_INFORMATION;
  9.    
  10.     UF_UI_message_buttons_t buttons;
  11.         
  12.     buttons.button1 = true;//控制按钮的数量
  13.     buttons.button2 = true;
  14.     buttons.button3 = true;

  15.     buttons.label1 = "确认";//按钮标签
  16.     buttons.label2 = "返回";
  17.     buttons.label3 = "退出";

  18.     buttons.response1 = 1;//按钮的返回值
  19.     buttons.response2 = 2;//按钮的返回值
  20.     buttons.response3 = 3;//按钮的返回值

  21.     UF_UI_message_dialog(title_string, dialog_type, &p, 1, 0, &buttons, &response);
  22.         
  23.     switch (response)//表达式

  24.     {
  25.    
  26.     case 1:  uc1601(buttons.label1, 1); break;//显示所选按钮的标签
  27.    
  28.     case 2:  uc1601(buttons.label2, 1); break;
  29.     case 3:  uc1601(buttons.label3, 1); break;
  30.     default:  uc1601("未知按钮", 1); break;
  31.     }




  32.     /* Terminate the API environment */
复制代码


就上UG网淘宝直营店
回复

使用道具 评分 举报

您需要登录后才可以回帖 登录 | 注册UG网

本版积分规则