📄 uguiyesnodialog.c
字号:
/*----------------------------------------------------------------------------- File: UgUIYesnoDialog.c Description: ProTK doc code sample PTC File Date Version Author Vers Comment--------- ------- -------- ----- ---------------------------------------------25-Oct-00 J-01-21 Scott $$1 Submitted.-----------------------------------------------------------------------------*/#include <ProToolkit.h>#include <ProUIDialog.h>#include <ProUIPushbutton.h>#define OK 1#define CANCEL 0/*-----------------------------------------------------------------*\ Example function to show how UsrConfirmAction() is used \*-----------------------------------------------------------------*/ int UsrExample() { ProBoolean confirm; UsrConfirmAction("Do you really want to delete the table?", &confirm); }/*====================================================================*\ FUNCTION : UsrOKAction() PURPOSE : Action function for the OK button \*====================================================================*/ static void UsrOKAction( char *dialog, char *component, ProAppData data) { ProUIDialogExit(dialog, OK); }/*====================================================================*\ FUNCTION : UsrCancelAction() PURPOSE : Action function for the Cancel button \*====================================================================*/ static void UsrCancelAction( char *dialog, char *component, ProAppData data) { ProUIDialogExit(dialog, CANCEL); }/*====================================================================*\ FUNCTION : UsrConfirmAction() PURPOSE : Utility to prompt the user with question,and OK and Cancel buttons. \*====================================================================*/ int UsrConfirmAction( char *question, ProBoolean *confirm) { ProLine wline; int status;/*--------------------------------------------------------------------*\ Load the dialog from the resource file \*--------------------------------------------------------------------*/ ProUIDialogCreate("confirm","confirm");/*--------------------------------------------------------------------*\ Set the OK and Cancel button actions \*--------------------------------------------------------------------*/ ProUIPushbuttonActivateActionSet("confirm","OK",UsrOKAction, NULL); ProUIPushbuttonActivateActionSet("confirm","Cancel",UsrCancelAction, NULL);/*--------------------------------------------------------------------*\ Set the Question test in the label \*--------------------------------------------------------------------*/ ProStringToWstring(wline, question); ProUILabelTextSet("confirm","Question",wline);/*--------------------------------------------------------------------*\ Display and activate the dialog \*--------------------------------------------------------------------*/ ProUIDialogActivate("confirm", &status);/*--------------------------------------------------------------------*\ Set confirm according to which button was used to close the dialog \*--------------------------------------------------------------------*/ *confirm = (status == OK) ? PRO_B_TRUE : PRO_B_FALSE;/*--------------------------------------------------------------------*\ Remove the dialog from memory \*--------------------------------------------------------------------*/ ProUIDialogDestroy("confirm"); return(1); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -