iCAx开思工具箱

标题: UI Styler Dialog Type: [TOP ] 怎樣用? [打印本页]

作者: aycheung    时间: 2003-6-5 17:48
标题: UI Styler Dialog Type: [TOP ] 怎樣用?
各位:
  
請問 UI Styler Dialog Type: [TOP ] 怎樣用?
  
可不可以做到 Dialog Box 永遠在 Window Top position? ::?
  
Thanks
作者: spline    时间: 2003-6-5 19:11
如果没有其它的 UI Styler Dialog Type出现,他将一直出现。
作者: spline    时间: 2003-6-5 19:15
肯定要用到的函数
UF_MB_add_actions( actionTable )
如果要开发一个单独的模块,要用 UF_MB_register_application
我记得ug给出了例子的。
作者: spline    时间: 2003-6-5 19:19
#include <stdio.h>
#include <uf_defs.h>
#include <uf.h>
#include <uf_exit.h>
#include <uf_mb.h>
#include <uf_ui_types.h>
#include <uf_ui.h>
  
static void SAMPLE_APP__enter( void );
static void SAMPLE_APP__init( void );
static void SAMPLE_APP__exit( void );
  
static UF_MB_cb_status_t SAMPLE_APP__action1(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button );
  
static UF_MB_cb_status_t SAMPLE_APP__action2(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button );
  
static UF_MB_cb_status_t SAMPLE_APP__action3(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button );
  
static UF_MB_cb_status_t SAMPLE_APP__action4(  
    UF_MB_widget_t             widget,  
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button );
  
static int app_id = 0;
  
static UF_MB_action_t actionTable[] =
{
  { "SAMPLE_APP__action1", SAMPLE_APP__action1, NULL    },
  { "SAMPLE_APP__action2", SAMPLE_APP__action2, NULL    },
  { "SAMPLE_APP__action3", SAMPLE_APP__action3, &app_id },
  { "SAMPLE_APP__action4", SAMPLE_APP__action4, NULL    },
  { NULL, NULL, NULL }
};
  
static void print_error( char* fun, int status );
  
/*----------------------------------------------------------------------------*
  *  PUBLIC void ufsta
  *                                                     
  *    Register the application
  *                       
  *----------------------------------------------------------------------------*/
/* ARGSUSED */
extern void ufsta( char *param, int *retcod, int param_len )
{
    UF_MB_application_t appData;
    char name[] = "SAMPLE_APP";
    int status;
  
    UF_initialize();                          /* Initialize User Function */
  
    status = UF_MB_add_actions( actionTable );
    print_error( "UF_MB_add_actions", status );
  
            /* Initialize application data */
  
    appData.name       = name;
    appData.id         = 0;
    appData.init_proc  = SAMPLE_APP__init;
    appData.exit_proc  = SAMPLE_APP__exit;
    appData.enter_proc = SAMPLE_APP__enter;
  
            /* Initialize application support flags */
  
    appData.drawings_supported          = TRUE;
    appData.design_in_context_supported = TRUE;
  
            /* Register the application with UG */
  
    status = UF_MB_register_application( [$appData )]
    print_error( "UF_MB_register_application", status );
  
    app_id = appData.id;
}
  
/*----------------------------------------------------------------------------*
  *  SAMPLE_APP__enter
  *
  *      Enter the application
  *----------------------------------------------------------------------------*/
static void SAMPLE_APP__enter( void)
{
    printf( "Entering application\n" );
  
    /* Place code to enter application here */
}
  
/*----------------------------------------------------------------------------*
  *  SAMPLE_APP__init
  *
  *      Initialize the application
  *----------------------------------------------------------------------------*/
static void SAMPLE_APP__init( void )
{
    printf( "Initializing application\n" );
  
    /* Place code to initialize application here */
}
  
/*----------------------------------------------------------------------------*
  *  SAMPLE_APP__exit
  *
  *      Exit the application
  *----------------------------------------------------------------------------*/
static void SAMPLE_APP__exit( void )
{
    printf( "Exiting application\n" );
  
    /* Place code to cleanup for application and exit here */
}
  
/*----------------------------------------------------------------------------*
  *  print_error
  *
  *      Print the error message corresponding to the status code specified if
  *      the status is non-zero.
  *----------------------------------------------------------------------------*/
static void print_error( char *fun, int status )
{
    if ( status != 0 )
    {
        char msg[133];
  
        UF_get_fail_message( status, msg );
        printf( "%s failed with error = %d\n  %s\n", fun, status, msg );
    }
}
  
/*----------------------------------------------------------------------------*
  *  get_button_id
  *
  *  Input:
  *      prompt - Cue prompt
  *
  *  Output:
  *      name - Button name specified by the user
  *      id   - ID corresponding the button name specified by the user
  *
  *  Return:
  *      Response
  *        1 = Back
  *        2 = Cancel
  *        3 = No data returned
  *        5 = Data returned
  *
  *----------------------------------------------------------------------------*/
static int get_button_id( char *prompt, char *name, int *id )
{
    int response = 0;
    int len = 0;
  
    UF_UI_lock_ug_access( UF_UI_FROM_CUSTOM );
    response = uc1600( prompt, name, [$len )]
    UF_UI_unlock_ug_access( UF_UI_FROM_CUSTOM );
  
    if ( response == 5 || ( response == 3 && len > 0 ) )
    {
        int status;
  
        response = 5;
        status = UF_MB_ask_button_id( name, id );
        print_error( "UF_MB_ask_button_id", status );
        if ( status != 0 )
        {
            char msg[133];
  
            response = 3;
            sprintf(msg, "%s button not found", name );
            UF_UI_lock_ug_access( UF_UI_FROM_CUSTOM );
            uc1601( msg, 0 );
            UF_UI_unlock_ug_access( UF_UI_FROM_CUSTOM );
        }
        else
        {
            printf( "    %s(%d)\n", name, *id );
        }
    }
  
    return( response );
}
  
/*----------------------------------------------------------------------------*
  *  SAMPLE_APP__action1
  *
  *      Allow the user to ask for the button ID corresponding to a button name
  *----------------------------------------------------------------------------*/
static UF_MB_cb_status_t SAMPLE_APP__action1(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button )
{
    UF_MB_cb_status_t cb_status = UF_MB_CB_CONTINUE;
    char name[133] = "";
    int  id = 0;
    int  response = 0;
  
    response = get_button_id( "Enter button to ask sensitivity of", name, [$id )]
  
    if ( response == 5 )
        cb_status = UF_MB_CB_CONTINUE;
    else if ( response == 1  || response == 2 )
        cb_status = UF_MB_CB_CANCEL;
    else
        cb_status = UF_MB_CB_ERROR;
  
    return( cb_status );
}
  
/*----------------------------------------------------------------------------*
  *  SAMPLE_APP__action2
  *
  *      Allow the user to specify this function's return value
  *----------------------------------------------------------------------------*/
static UF_MB_cb_status_t SAMPLE_APP__action2(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button )
{
#define NUM_OPTIONS 5
  
    char options[NUM_OPTIONS][38] = { "UF_MB_CB_CONTINUE",
                                      "UF_MB_CB_CANCEL",
                                      "UF_MB_CB_OVERRIDE_STANDARD",
                                      "UF_MB_CB_WARNING",
                                      "UF_MB_CB_ERROR"
                                    };
    int option_cnt = NUM_OPTIONS;
    int response = 0;
    UF_MB_cb_status_t cb_value = UF_MB_CB_CANCEL;
  
    UF_UI_lock_ug_access( UF_UI_FROM_CUSTOM );
    response = uc1603( "Choose value to return", 0, options, option_cnt );
    UF_UI_unlock_ug_access( UF_UI_FROM_CUSTOM );
  
    switch ( response )
    {
        case 1:
        case 2:
            cb_value = UF_MB_CB_CANCEL;
            printf( "    Response = \"%s\" (%d)\n",
                    ( response == 1 ? "Back" : "Cancel" ), response );
            break;
  
        case 5:
            cb_value = UF_MB_CB_CONTINUE;
            break;
  
        case 6:
            cb_value = UF_MB_CB_CANCEL;
            break;
  
        case 7:
            cb_value = UF_MB_CB_OVERRIDE_STANDARD;
            break;
  
        case 8:
            cb_value = UF_MB_CB_WARNING;
            break;
  
        case 9:
            cb_value = UF_MB_CB_ERROR;
            break;
  
        default:
            cb_value = UF_MB_CB_ERROR;
            printf( "    Response = \"%s\" (%d)\n", "Unexpected", response );
            break;
    }
  
    printf( "Return = %s\n", [$options[response - 5][0] )]
  
    return( cb_value );
}
  
/*----------------------------------------------------------------------------*
  *  SAMPLE_APP__action3
  *
  *      Print the current application's ID
  *----------------------------------------------------------------------------*/
static UF_MB_cb_status_t SAMPLE_APP__action3(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button )
{
    int curr_app_id = *((int *) client_data);
  
    printf( "Application ID = %d\n", curr_app_id );
  
    return( UF_MB_CB_CONTINUE );
}
  
/**************************************************************************
  * Function Name: SAMPLE_APP__action4
  *
  * Functions Description:
  *   Print the callback data for a button
  *
  * Input
  *
  * Output
  *   None
  *
  * Description -  
  *
  * Returns - status code to continue or terminate
  **************************************************************************/
static UF_MB_cb_status_t SAMPLE_APP__action4(
    UF_MB_widget_t             widget,
    UF_MB_data_t               client_data,
    UF_MB_activated_button_p_t call_button )
{
      char buf[1024];
      char *type_name;
  
      UF_UI_open_listing_window();      
  
      sprintf(buf, "Button Name = %s\n", call_button->name );
      UF_UI_write_listing_window( buf );
      sprintf(buf, "Button Id = %d\n", call_button->id );
      UF_UI_write_listing_window( buf );
      if ( UF_MB_ask_button_type_name( call_button->type, &type_name ) == 0 )  
      {
           sprintf(buf, "Button Type = %s\n", type_name );
           UF_UI_write_listing_window( buf );
      }
      sprintf(buf, "Menubar Name = %s\n", call_button->menubar_name );
      UF_UI_write_listing_window( buf );
      if ( call_button->num_ancestors > 0 )
      {
          int j;
          
          UF_UI_write_listing_window( " \n" );
          UF_UI_write_listing_window( "Button Ancestors:\n" );
          for ( j = call_button->num_ancestors - 1; j >= 0; j-- )
          {
                sprintf(buf, "    %s\n", call_button->ancestors[j] );
                UF_UI_write_listing_window( buf );
          }
      }
      UF_UI_write_listing_window( " \n" );
      return( UF_MB_CB_CONTINUE );
}
作者: zzz    时间: 2003-6-5 21:58
在用UI STYLER生成对话框的时候,不是有一个选项嘛。
作者: aycheung    时间: 2003-6-6 08:46
請問有没有 範例提供給我下載?
  
::y
作者: spline    时间: 2003-6-11 08:16
ug提供了例子了的。就在ugopen那个目录下
作者: aycheung    时间: 2003-6-11 15:56
請問那個檔案名稱是什麼?? 8D
作者: spline    时间: 2003-6-12 08:37
我做了一个Demo,去精华版去看吧。https://www.icax.org/viewthread. ... 3D1&page=2#pid=
作者: 789zenghong    时间: 2011-9-12 14:19
:yan::yan:
学习中。。。。。。




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3