listing_8_30.c

来自「This source code has been tested under O」· C语言 代码 · 共 60 行

C
60
字号
/*************************************************************************                                                                    ****  listing_8_30.c                                                    ****                                                                    ****  Demonstration of accelerators, using two pushbuttons.             ****                                                                    *************************************************************************/#include <Xm/BulletinBP.h>#include <Xm/LabelP.h>#include <Xm/PushBP.h>#include <Xm/BulletinB.h>#include <Xm/PushB.h>void    Btn1CB();                       /* FORWARD Definition         */Widget  appshell,        the_bb,        buttons[2];void main( argc, argv )    int     argc;    char    *argv[];{    appshell = XtInitialize( argv[0], "Listing_8_30", NULL, 0, &argc, argv );    the_bb = XmCreateBulletinBoard( appshell, "BB", NULL, 0 );    XtManageChild( the_bb );    buttons[0] = XmCreatePushButton( the_bb, "Button_0", NULL, 0 );    buttons[1] = XmCreatePushButton( the_bb, "Button_1", NULL, 0 );    XtManageChildren( buttons, 2 );    XtAddCallback( buttons[1], XmNactivateCallback, Btn1CB, NULL );    XtInstallAccelerators( buttons[0], buttons[1] );    XtRealizeWidget( appshell );    XtMainLoop();}void Btn1CB( w, client_data, call_data )    Widget              w;    caddr_t             client_data;    XmAnyCallbackStruct *call_data;{    printf( "\nButton 1 Activated\n" );    if (call_data->event == NULL)        printf( "Event is NULL\n" );    else        printf( "Event is not NULL\n" );}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?