找回密码
 注册
Simdroid-非首页
查看: 45|回复: 0

[二次开发] display message dialog

[复制链接]
发表于 2009-10-15 00:12:45 | 显示全部楼层 |阅读模式 来自 河北廊坊
#include <stdio.h>
#include <string.h>

#include <uf.h>
#include <uf_ui.h>
#include <uf_object_types.h>

#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))

static int report_error( char *file, int line, char *call, int irc)
{
    if (irc)
    {
        char err[133],
             msg[133];

        sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
            irc, line, file);
        UF_get_fail_message(irc, err);

    /*  NOTE:  UF_print_syslog is new in V18 */

        UF_print_syslog(msg, FALSE);
        UF_print_syslog(err, FALSE);
        UF_print_syslog("\n", FALSE);
        UF_print_syslog(call, FALSE);
        UF_print_syslog(";\n", FALSE);

        if (!UF_UI_open_listing_window())
        {
            UF_UI_write_listing_window(msg);
            UF_UI_write_listing_window(err);
            UF_UI_write_listing_window("\n");
            UF_UI_write_listing_window(call);
            UF_UI_write_listing_window(";\n");
        }
    }

    return(irc);
}

#define WRITE_D(X) (write_integer_to_listing_window(#X, X))

static void write_integer_to_listing_window(char *title, int n)
{
    char
        msg[MAX_LINE_SIZE+1];

    UF_CALL(UF_UI_open_listing_window());
    sprintf(msg, "%s = %d\n", title, n);
    UF_CALL(UF_UI_write_listing_window(msg));
}

static void do_it(void)
{
    int
        response = 0;
    char
        *messages[3] = { "Message One", "Message Two", "Message Three" };
        
    UF_UI_message_buttons_t
        buttons;
            
    buttons.button1 = TRUE; /* OK button */
    buttons.button2 = TRUE; /* BACK button */
    buttons.button3 = TRUE; /* CANCEL button */
   
    buttons.label1 = "MY_OK";
    buttons.label2 = "MY_BACK";
    buttons.label3 = NULL;   /* will use the default value */
   
    buttons.response1 = 2;
    buttons.response2 = 4;
    buttons.response3 = 6;
            
    UF_CALL( UF_UI_message_dialog( "My Dialog Title",
                                   UF_UI_MESSAGE_INFORMATION,
                                   messages, 3, FALSE,
                                   &buttons, &response ));

    WRITE_D( response );
}

/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
    if (UF_CALL(UF_initialize())) return;
    do_it();
    UF_terminate();
}

int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-20 01:00 , Processed in 0.030749 second(s), 15 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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