iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 24580|回复: 4
打印 上一主题 下一主题

UIS对话框调用UIS对话框(嵌套调用)

[复制链接]
跳转到指定楼层
楼主
发表于 2004-7-28 21:23:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
我用UIS作了2个对话框,第一个:lgl_01.dlg,第二个:lgl_02.dlg;lgl_01.dlg由MenuScript调用,很简单,只要ACTIONS lgl_01.dlg就可以,但lgl_01.dlg对话框调用lgl_02.dlg对话框,不知道怎么改代码,请高手帮帮忙(见附件)
  
  第一个对话框的代码
  
/* These include files are needed for the following template code.            */
#include <stdio.h>  
#include <uf.h>
#include <uf_defs.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_styler.h>
#include <uf_mb.h>  
#include "lgl_01.h"
  
/* The following definition defines the number of callback entries */
/* in the callback structure:                                      */
/* UF_STYLER_callback_info_t CHANGE_cbs */
#define CHANGE_CB_COUNT ( 2 + 1 ) /* Add 1 for the terminator */
   
/*--------------------------------------------------------------------------
The following structure defines the callback entries used by the        
styler file.  This structure MUST be passed into the user function,     
UF_STYLER_create_dialog along with CHANGE_CB_COUNT.                        
--------------------------------------------------------------------------*/
static UF_STYLER_callback_info_t CHANGE_cbs[CHANGE_CB_COUNT] =  
{
  {UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB        , 1, CHANGE_apply01_cb},
  {CHANGE_ACTION_0       , UF_STYLER_ACTIVATE_CB     , 0, CHANGE_action_0_act_cb},
  {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
};
  
static UF_MB_styler_actions_t actions[] = {
    { "lgl_01.dlg",  NULL,   CHANGE_cbs,  UF_MB_STYLER_IS_NOT_TOP },
    { NULL,  NULL,  NULL,  0 } /* This is a NULL terminated list */
};
  
extern int lgl(int *response);/*自己定义的函数
  
extern void ufsta (char *param, int *retcode, int rlen)
{
    int  error_code;
   
    if ( (UF_initialize()) != 0)  
          return;
                                                 
    if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )
    {
          char fail_message[133];
          
          UF_get_fail_message(error_code, fail_message);
          printf ( "%s\n", fail_message );  
    }
                                                 
    UF_terminate();                              
    return;
}
  /*MENUBAR_COMMENTED_OUT*/
  
int CHANGE_apply01_cb ( int dialog_id,
             void * client_data,
             UF_STYLER_item_value_type_p_t callback_data)
{
     /* Make sure User Function is available. */   
     if ( UF_initialize() != 0)  
          return ( UF_UI_CB_CONTINUE_DIALOG );
  
     /* ---- Enter your callback code here ----- */
   uc1601("你好",1);
     UF_terminate ();
  
    /* Callback acknowledged, do not terminate dialog                 */
    /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted    */
    /* for this callback type.  You must respond to your apply button.*/
    return (UF_UI_CB_CONTINUE_DIALOG);  
  
}
  
int CHANGE_action_0_act_cb ( int dialog_id,
             void * client_data,
             UF_STYLER_item_value_type_p_t callback_data)
{    int response;
  
     /* Make sure User Function is available. */   
     if ( UF_initialize() != 0)  
          return ( UF_UI_CB_CONTINUE_DIALOG );
  
     /* ---- Enter your callback code here ----- */
    UF_STYLER_create_dialog("lgl_02.dlg",
            CHANGE_cbs,
            CHANGE_CB_COUNT,
            NULL,
            [$response)]
  
   lgl([$response)]
  
     UF_terminate ();
  
    /* Callback acknowledged, do not terminate dialog */
    return (UF_UI_CB_CONTINUE_DIALOG);  
    
    /* or Callback acknowledged, terminate dialog.    */
    /* return ( UF_UI_CB_EXIT_DIALOG );               */
  
}
  
第二个对话框的代码
  
/*=============================================================================
   WARNING!!  This file is overwritten by the UIStyler each time the Styler  
   file is saved.
  
  
        Filename:  lgl_02_template.c
  
        This file was generated by the UG User Interface Styler
        Created by: lgl
        Version: Unigraphics V18.0.0.16
              Date: 07-28- 4
              Time: 17:10
  
   This template file is overwritten each time the UIStyler dialog is
   saved.  Any modifications to this file will be lost.
==============================================================================*/
   
  
/*==============================================================================
  &nbspurpose:  This TEMPLATE file contains C source and static structures to      
   guide you in the construction of your UG/Open application dialog.            
   The generation of your dialog file (.dlg extension) is the first step towards
   dialog construction within Unigraphics.  You must now create a UGOpen         
   application that utilizes this file (.dlg).                                   
                                                                                
   The information in this file provides you with the following:                 
                                                                                
   1.  Help on the use of the functions, UF_MB_add_styler_actions and            
       UF_STYLER_create_dialog in your UG/Open application.  These functions     
       will load and display your UIStyler dialog in Unigraphics.               
                                                                                
       An example of the function, UF_MB_add_styler_actions to associate your   
       dialog to the menubar is shown below (Search on Example 1).               
                                                                                
       An example of a invoking a dialog from a callback utilizing               
       UF_STYLER_create_dialog is also shown below (Search for Example 2).      
                                                                                
       An example of a user exit utilizing UF_STYLER_create_dialog is also      
       shown below (Search for Example 3).                                       
                                                                                
   2.  The callback structure: --- CHANGE_cbs ---               
       This structure is VERY important if you have callbacks associated with   
       your dialog.  It correlates the dialog items in your dialog with the      
       callback functions you must supply.  You should not modify this           
       structure since it MUST match up to the information stored in your        
       dialog file (.dlg).  Any attempt to do so will cause an error while      
       constructing your dialog.   If you wish to modify the association of      
       your callbacks to your dialog, please reload your dialog file (.dlg) into
       the UIStyler and regenerate your files.                                   
       You do not need to be concerned about this structure, simply pass it as   
       an argument to the function, UF_STYLER_create_dialog along with your      
       dialog file (.dlg).
       
       Example 1 displays the actual call you may make for this particular      
       dialog.                                                                  
                                                                                
   3.  The empty callback functions (stubs) associated with your dialog items   
       have also been placed in this file.  These empty functions have been      
       created simply to start you along with your coding requirements.         
       The function name, argument list and possible return values have already  
       been provided for you.                                                   
                                                                                
NOTE:  Each callback must be wrappered with the functions UF_initialize()        
       and UF_terminate().                                                      
                                                                                
==============================================================================*/
  
/* These include files are needed for the following template code.            */
#include <stdio.h>  
#include <uf.h>
#include <uf_defs.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_styler.h>
#include <uf_mb.h>  
#include "lgl_02.h"
  
/* The following definition defines the number of callback entries */
/* in the callback structure:                                      */
/* UF_STYLER_callback_info_t CHANGE_cbs */
#define CHANGE_CB_COUNT ( 2 + 1 ) /* Add 1 for the terminator */
   
/*--------------------------------------------------------------------------
The following structure defines the callback entries used by the        
styler file.  This structure MUST be passed into the user function,     
UF_STYLER_create_dialog along with CHANGE_CB_COUNT.                        
--------------------------------------------------------------------------*/
static UF_STYLER_callback_info_t CHANGE_cbs[CHANGE_CB_COUNT] =  
{
  {UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB  , 1, CHANGE_constructor_cb},
  {UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB        , 0, CHANGE_apply02_cb},
  {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
};
  
/*--------------------------------------------------------------------------
UF_MB_styler_actions_t contains 4 fields.  These are defined as follows:
   
Field 1 : the name of your dialog that you wish to display.
Field 2 : any client data you wish to pass to your callbacks.
Field 3 : your callback structure.
Field 4 : flag to inform menubar of your dialog location.  This flag MUST   
          match the resource set in your dialog!  Do NOT ASSUME that changing  
          this field will update the location of your dialog.  Please use the  
          UIStyler to indicate the position of your dialog.
--------------------------------------------------------------------------*/
static UF_MB_styler_actions_t actions[] = {
    { "lgl_02.dlg",  NULL,   CHANGE_cbs,  UF_MB_STYLER_IS_NOT_TOP },
    { NULL,  NULL,  NULL,  0 } /* This is a NULL terminated list */
};
  
/*---------------- MENUBAR HOOKUP HELP Example -------------------
To launch this dialog from a Unigraphics menubar, you must follow  
the steps below.
1)  Add the following lines to your MenuScript file in order to  
    associate a menu bar button with your dialog.  In this      
    example, a cascade menu will be created and will be         
    located just before the Help button on the main menubar.   
    The button, LGL_02_BTN is set up to launch your dialog and  
    will be positioned as the first button on your pulldown menu.
    If you wish to add the button to an existing cascade, simply  
    add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU   
    to your menuscript file.   
    
    The MenuScript file requires an extension of ".men".
    Make sure that you add the extension to the file and place   
    the file in your startup directory:
      $UGII_USER_DIR/startup or  
      $UGII_SITE_DIR/startup or  
      $UGII_VENDOR_DIR/startup directory
  
    Move the contents between the dashed lines to your Menuscript file.
!   ----------------------------------------------------------------
    VERSION 120
  
    EDIT UG_GATEWAY_MAIN_MENUBAR
  
    BEFORE UG_HELP
      CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN
      LABEL Dialog Launcher
    END_OF_BEFORE
   
    MENU UISTYLER_DLG_CASCADE_BTN
      BUTTON LGL_02_BTN
      LABEL Display lgl_02 dialog
      ACTIONS lgl_02.dlg
    END_OF_MENU
!   ---------------------------------------------------------------
  
2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta
   user exit as shown below.  To use this call, remove the conditional  
   definitions:  #ifdef MENUBAR_COMMENTED_OUT  
                 #endif MENUBAR_COMMENTED_OUT  
   
   The static structure, actions, will allow you to associate ALL of your
   dialogs and callback functions to the  menubar at once.  For example, if you  
   wish to have 10 dialogs associated to 10 different buttons on the menubar,
   you may enter each dialog and callback list into the actions structure. Make
   sure that you have created a corresponding button in your MenuScript file.
   
   You may also have separate shared libraries, each with a ufsta user exit
   for each individual dialog.
  
3) Place your compiled and linked ufsta user function in  
   $UGII_USER_DIR/startup or   
   $UGII_SITE_DIR/startup or  
   $UGII_VENDOR_DIR/startup directory.      
   
   NOTE:  The user function must contain the proper extension .so, .sl or .dll  
   to make ensure that it is recognized by the MenuScript.  If it does not
   have the proper extension, it will NOT be recognized by MenuScript.     
  
   The action name you have provided in your MenuScript must correspond to
   to the dialog name provided in the action structure.  This MUST match inorder
   to bind your dlg file to your MenuScript button.                             
  
4) Copy your UIStyler dialog file to the proper directory.
   All dialog files (.dlg) must be located in  
      $UGII_USER_DIR/application or  
      $UGII_SITE_DIR/application or  
      $UGII_VENDOR_DIR/application directory
  
------------------------------------------------------------*/
#ifdef MENUBAR_COMMENTED_OUT
extern void ufsta (char *param, int *retcode, int rlen)
{
    int  error_code;
   
    if ( (UF_initialize()) != 0)  
          return;
                                                 
    if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )
    {
          char fail_message[133];
          
          UF_get_fail_message(error_code, fail_message);
          printf ( "%s\n", fail_message );  
    }
                                                 
    UF_terminate();                              
    return;
}
#endif /*MENUBAR_COMMENTED_OUT*/
  
/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------
If you wish to have this dialog displayed from the callback of  
another UIStyler dialog, you should:                           
  
1) Make sure that the callback of your UIStyler dialog is  
   designated as a dialog building callback.               
2) Remove the conditional definitions:
   #ifdef DISPLAY_FROM_CALLBACK  
   #endif DISPLAY_FROM_CALLBACK
3) Your callback should issue a call to this function.
4) You should also add the funcitonal prototype to your header file  
   (lgl_02.h) and ensure that the file is properly included.
  
All dialog files must be located in  
      $UGII_USER_DIR/application or  
      $UGII_SITE_DIR/application or  
      $UGII_VENDOR_DIR/application directory
--------------------------------------------------------------*/
  
extern int lgl(int *response)
{
    int  error_code = 0;
   
    if ( ( error_code = UF_initialize() ) != 0 )  
           return (0) ;
  
    if ( ( error_code = UF_STYLER_create_dialog ( "lgl_02.dlg",
           CHANGE_cbs,      /* Callbacks from dialog */
           CHANGE_CB_COUNT, /* number of callbacks*/
           NULL,        /* This is your client data */
           response ) ) != 0 )
    {
          char fail_message[133];
  
          /* Get the user function fail message based on the fail code.*/
          UF_get_fail_message(error_code, fail_message);
          UF_UI_set_status (fail_message);
          printf ( "%s\n", fail_message );  
    }
  
    UF_terminate();                              
    return (error_code);
}
  /* DISPLAY_FROM_CALLBACK */  
  
/*-------DIALOG CREATION FROM A USER EXIT HELP Example --------
To create this dialog from a user exit, you must invoke a      
call to the UG/Open API, UF_STYLER_create_dialog.  An example  
is shown below.                                                
  
All dialog files must be located in  
      $UGII_USER_DIR/application or  
      $UGII_SITE_DIR/application or  
      $UGII_VENDOR_DIR/application directory
  
1) Remove the conditional definitions:
   #ifdef DISPLAY_FROM_USER_EXIT  
   #endif DISPLAY_FROM_USER_EXIT  
2) Add a user exit to the function name below, for example, ufusr.
3) Consider how your shared library will be unloaded.  Take a look
   at the generated function ufusr_ask_unload.
--------------------------------------------------------------*/
  
#ifdef DISPLAY_FROM_USER_EXIT
extern void <enter a valid user exit here> (char *param, int *retcode, int rlen)
{
    int  response   = 0;
    int  error_code = 0;
   
    if ( ( UF_initialize() ) != 0 )  
           return;
  
    if ( ( error_code = UF_STYLER_create_dialog ( "lgl_02.dlg",
           CHANGE_cbs,      /* Callbacks from dialog */
           CHANGE_CB_COUNT, /* number of callbacks*/
           NULL,        /* This is your client data */
           &response ) ) != 0 )
    {
          char fail_message[133];
  
          /* Get the user function fail message based on the fail code.*/
          UF_get_fail_message(error_code, fail_message);
          UF_UI_set_status (fail_message);
          printf ( "%s\n", fail_message );  
    }
  
    UF_terminate();                              
    return;
}
  
/*--------------------------------------------------------------------------
This function specifies how a shared image is unloaded from memory           
within Unigraphics. This function gives you the capability to unload an      
internal UG/Open application or user  exit from Unigraphics.  You can        
specify any one of the three constants as a return value to determine        
the type of unload to perform:  immediately after user function              
execution, via an unload selection dialog, or when Unigraphics terminates   
terminates.  If you choose UF_UNLOAD_SEL_DIALOG, then you have the           
option to unload your image by selecting  File->Utilities->Unload Shared     
Image.  
  
NOTE:  A program which associates UG/Open applications with the menubar      
MUST NOT use this option since it will UNLOAD your UG/Open application image
--------
from the menubar.
--------------------------------------------------------------------------*/
  
extern int ufusr_ask_unload (void)
{
     /* unload immediately after application exits*/
     return ( UF_UNLOAD_IMMEDIATELY );
  
     /*via the unload selection dialog... */
     /*return ( UF_UNLOAD_SEL_DIALOG );   */
     /*when UG terminates...              */
     /*return ( UF_UNLOAD_UG_TERMINATE ); */
}
  
/*--------------------------------------------------------------------------
You have the option of coding the cleanup routine to perform any housekeeping
chores that may need to be performed.  If you code the cleanup routine, it is
automatically called by Unigraphics.
--------------------------------------------------------------------------*/
extern void ufusr_cleanup (void)
{
    return;
}
#endif /* DISPLAY_FROM_USER_EXIT */  
  
/*-------------------------------------------------------------------------*/
/*---------------------- UIStyler Callback Functions ----------------------*/
/*-------------------------------------------------------------------------*/
  
/* -------------------------------------------------------------------------
  * Callback Name: CHANGE_constructor_cb
  * This is a callback function associated with an action taken from a
  * UIStyler object.  
  *
  * Input: dialog_id   -   The dialog id indicate which dialog this callback
  *                        is associated with.  The dialog id is a dynamic,
  *                        unique id and should not be stored.  It is
  *                        strictly for the use in the UG/Open API:
  *                               UF_STYLER_ask_value(s)  
  *                               UF_STYLER_set_value   
  *        client_data -   Client data is user defined data associated
  *                        with your dialog.  Client data may be bound
  *                        to your dialog with UF_MB_add_styler_actions
  *                        or UF_STYLER_create_dialog.                  
  *        callback_data - This structure pointer contains information
  *                        specific to the UIStyler Object type that   
  *                        invoked this callback and the callback type.
  * -----------------------------------------------------------------------*/
int CHANGE_constructor_cb ( int dialog_id,
             void * client_data,
             UF_STYLER_item_value_type_p_t callback_data)
{     
     /* Make sure User Function is available. */   
     if ( UF_initialize() != 0)  
          return ( UF_UI_CB_CONTINUE_DIALOG );
  
     /* ---- Enter your callback code here ----- */
  
     UF_terminate ();
  
    /* Callback acknowledged, do not terminate dialog */
    return (UF_UI_CB_CONTINUE_DIALOG);  
    /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted    */
    /* for this callback type.  You must continue dialog construction.*/
  
}
  
/* -------------------------------------------------------------------------
  * Callback Name: CHANGE_apply02_cb
  * This is a callback function associated with an action taken from a
  * UIStyler object.  
  *
  * Input: dialog_id   -   The dialog id indicate which dialog this callback
  *                        is associated with.  The dialog id is a dynamic,
  *                        unique id and should not be stored.  It is
  *                        strictly for the use in the UG/Open API:
  *                               UF_STYLER_ask_value(s)  
  *                               UF_STYLER_set_value   
  *        client_data -   Client data is user defined data associated
  *                        with your dialog.  Client data may be bound
  *                        to your dialog with UF_MB_add_styler_actions
  *                        or UF_STYLER_create_dialog.                  
  *        callback_data - This structure pointer contains information
  *                        specific to the UIStyler Object type that   
  *                        invoked this callback and the callback type.
  * -----------------------------------------------------------------------*/
int CHANGE_apply02_cb ( int dialog_id,
             void * client_data,
             UF_STYLER_item_value_type_p_t callback_data)
{
     /* Make sure User Function is available. */   
     if ( UF_initialize() != 0)  
          return ( UF_UI_CB_CONTINUE_DIALOG );
  
     /* ---- Enter your callback code here ----- */
  
     UF_terminate ();
  
    /* Callback acknowledged, do not terminate dialog                 */
    /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted    */
    /* for this callback type.  You must respond to your apply button.*/
    return (UF_UI_CB_CONTINUE_DIALOG);  
  
}
  
  

70-2153568--embed.JPG (14.54 KB, 下载次数: 11)

阅读权限: 1

70-2153568--embed.JPG
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
 楼主| 发表于 2004-7-28 21:39:15 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
板凳
发表于 2004-7-29 09:10:58 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
地板
 楼主| 发表于 2004-7-29 10:23:08 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
5
发表于 2004-7-30 16:07:18 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-12-24 11:16 , Processed in 0.018348 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表