📄 samp8.c
字号:
/*load head file*/
#include<ProToolkit.h>#include<Pro2dEntdef.h>#include<ProANSI.h>#include<ProAnimate.h>#include<ProArray.h>#include<ProAsmcomp.h>#include<ProAsmcomppath.h>#include<ProAssembly.h>#include<ProAxis.h>#include<ProChamfer.h>#include<ProClCmd.h>#include<ProColor.h>#include<ProComm.h>#include<ProConst.h>#include<ProContour.h>#include<ProContourdata.h>#include<ProCore.h>#include<ProCsys.h>#include<ProCsysdata.h>#include<ProCurve.h>#include<ProCurvedata.h>#include<ProDatumdata.h>#include<ProDisplist.h>#include<ProDtmAxis.h>#include<ProDtmCrv.h>#include<ProDtmCrvSketch.h>#include<ProDtmCsys.h>#include<ProDtmPln.h>#include<ProEdge.h>#include<ProEdgedata.h>#include<ProElemId.h>#include<ProElement.h>#include<ProElempath.h>#include<ProExpldstate.h>#include<ProExtdata.h>#include<ProExtobj.h>#include<ProExtobjCB.h>#include<ProExtobjDisp.h>#include<ProExtobjRef.h>#include<ProExtobjSel.h>#include<ProExtrude.h>#include<ProFaminstance.h>#include<ProFamtable.h>#include<ProFeatForm.h>#include<ProFeatType.h>#include<ProFeature.h>#include<ProFixture.h>#include<ProFlatSrf.h>#include<ProForeignCurve.h>#include<ProGeomitem.h>#include<ProGeomitemdata.h>#include<ProGraphic.h>#include<ProGroup.h>#include<ProHardware.h>#include<ProImportfeat.h>#include<ProIntfData.h>#include<ProItemerr.h>#include<ProLayer.h>#include<ProLayerR19.h>#include<ProMaterial.h>#include<ProMdl.h>#include<ProMenu.h>#include<ProMenuBar.h>#include<ProMessage.h>#include<ProMfg.h>#include<ProMfgoper.h>#include<ProModFeat.h>#include<ProMode.h>#include<ProModelitem.h>#include<ProNcseq.h>#include<ProNcseqElem.h>#include<ProNote.h>#include<ProNotify.h>#include<ProObjects.h>#include<ProParameter.h>#include<ProParamval.h>#include<ProPart.h>#include<ProPattern.h>#include<ProPecktable.h>#include<ProPoint.h>#include<ProProcstep.h>#include<ProQuilt.h>#include<ProQuiltdata.h>#include<ProRelSet.h>#include<ProReplace.h>#include<ProRevolve.h>#include<ProRmdt.h>#include<ProRule.h>#include<ProSecConstr.h>#include<ProSecdim.h>#include<ProSecdimType.h>#include<ProSecerror.h>#include<ProSection.h>#include<ProSelection.h>#include<ProSheetmetal.h>#include<ProSimprep.h>#include<ProSimprepdata.h>#include<ProSizeConst.h>#include<ProSolid.h>#include<ProStdSection.h>#include<ProSurface.h>#include<ProSurfacedata.h>#include<ProSweep.h>#include<ProTool.h>#include<ProToolElem.h>#include<ProToolinput.h>#include<ProUICmd.h>#include<ProUtil.h>#include<ProValue.h>#include<ProVerstamp.h>#include<ProView.h>#include<ProWcell.h>#include<ProWchar.h>#include<ProWindows.h>#include<ProWorkspace.h>#include<ProWstring.h>int MiscAction();
ProFileName UserMsg;
#define OK 1
#define CANCEL 0
/*--------------------------------------------------------------------*\Application global data\*--------------------------------------------------------------------*/static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode){ return (ACCESS_AVAILABLE);}/*===========================================================================*\ Function : main Purpose : Test the ProToolkitMain() function. main is optional function.\*===========================================================================*/main(argc, argv)int argc;char **argv;{ ProToolkitMain(argc, argv); return(0);}/*====================================================================*\FUNCTION : user_initialize()PURPOSE : Pro/DEVELOP standard initialize - define menu button\*====================================================================*/int user_initialize( int argc, char *argv[], wchar_t errbuf[80]){
int UsrExample();
int i, menu_id;
ProError status;
uiCmdCmdId cmd_id;
/*----------------------------------------------------------------*\
消息文件
\*----------------------------------------------------------------*/
ProStringToWstring (UserMsg, "msg.txt");
ProMessageDisplay (UserMsg, "USER %0s",
"Demo of Invoking the Dialog.");
/*---------------------------------------------------------------------*\
Add new button to the menu bar
\*---------------------------------------------------------------------*/
status = ProCmdActionAdd("MyCmd",
(uiCmdCmdActFn)UsrExample,
uiProe2ndImmediate, TestAccessDefault,
PRO_B_TRUE, PRO_B_TRUE, &cmd_id);
status = ProMenubarmenuPushbuttonAdd(
"File", "MyCmd", "Show Dialog", "Show the Dialog",
"File.psh_exit", PRO_B_TRUE, cmd_id, UserMsg);
return (0);
}
/*====================================================================*\
FUNCTION : user_terminate()
PURPOSE : To handle any termination actions
\*====================================================================*/
void user_terminate()
{
}
/*-----------------------------------------------------------------*\
Example function to show how UsrConfirmAction() is used
\*-----------------------------------------------------------------*/
int UsrExample()
{
ProBoolean confirm;
UsrConfirmAction("是否需要进行删除操作?", &confirm);
}
/*====================================================================*\
FUNCTION : UsrOKAction() PURPOSE : Action function for the OK button
\*====================================================================*/
void UsrOKAction(
char *dialog,
char *component,
ProAppData data)
{
ProUIDialogExit(dialog, OK);
}
/*====================================================================*\
FUNCTION : UsrCancelAction()
PURPOSE : Action function for the Cancel button
\*====================================================================*/
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
\*--------------------------------------------------------------------*/
status = ProUIDialogCreate("confirm","dlg7");
/*--------------------------------------------------------------------*\
Set the OK and Cancel button actions
\*--------------------------------------------------------------------*/
ProUIPushbuttonActivateActionSet("confirm","确认",UsrOKAction, NULL);
ProUIPushbuttonActivateActionSet("confirm","取消",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 + -