listing_8_27.c
来自「This source code has been tested under O」· C语言 代码 · 共 74 行
C
74 行
/************************************************************************* **** listing_8_27.c **** **** Demonstration of actions and translations, using a pushbutton. **** *************************************************************************/#include <Xm/PushB.h>void ActionOne(); /* FORWARD definitions */void ActionTwo();Widget appshell, the_btn;XtActionsRec action_tab[] = { { "actionOne", ActionOne }, { "actionTwo", ActionTwo } };void main( argc, argv ) int argc; char *argv[];{ appshell = XtInitialize( argv[0], "Listing_8_27", NULL, 0, &argc, argv ); XtAddActions( action_tab, XtNumber(action_tab) ); the_btn = XmCreatePushButton( appshell, "TheBtn", NULL, 0 ); XtManageChild( the_btn ); XtRealizeWidget( appshell ); XtMainLoop();}void ActionOne( w, event, params, num_params ) Widget w; XEvent *event; char *params[]; int *num_params;{ int i; printf( "\nAction 1 Invoked\n" ); printf( " %d Params:", *num_params ); for (i = 0 ; i < *num_params ; i++) printf( " %s", params[i] ); printf( "\n" );}void ActionTwo( w, event, params, num_params ) Widget w; XEvent *event; char *params[]; int *num_params;{ int i; printf( "\nAction 2 Invoked\n" ); printf( " %d Params:", *num_params ); for (i = 0 ; i < *num_params ; i++) printf( " %s", params[i] ); printf( "\n" );}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?