请教唐先生.函数调用

唐先生:
您好,我用PhAB编了一个程序,调用一个函数,在编译时总是出错,特向您请教。程序代码如下:

int
wmclose( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

{

PhWindowEvent_t *we=cbinfo->cbdata;
char *btns[]={"&Yes", “&No”, “&Save”};
char Helvetica14[MAX_FONT_TAG];
int filesel(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t cbinfo);


/
eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

if(we->event_f==Ph_WM_CLOSE)
{
switch(PtAlert(ABW_base,NULL,NULL,NULL,
“Do you really want to exit”,
PfGenerateFontName(“Helvetica”,0,14,Helvetica14),
3,btns,NULL,1,2,Pt_MODAL)){
case 1:
PtExit(EXIT_SUCCESS);
break;
case 2:
return (Pt_CONTINUE);
case 3:
filesel();调用函数,参数是什么
break;
}
}

return( Pt_CONTINUE );
}

int
filesel( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PtFileSelectionInfo_t info;
PtArg_t args[1];
int k;

/* Initialize the widget library and connect to Photon. */
PtInit( NULL );

/* Initialize the file-select info structure */
memset( &info, 0x0, sizeof(PtFileSelectionInfo_t) );

/* Change the name-column label of the PtFileSel widget
in the filesel dialog from the default “Name” to “Nom” */

PtSetArg( args, Pt_ARG_FS_LBL_NAME, “Nom:”, 0 );
info.args = args;
info.num_args = 1;

/* Invoke the convenience function. /
k = PtFileSelection( NULL, /
parent /
NULL, /
pos /
“PtFileSelection Example”, /
title /
“~”, /
root_dir, tilde is the home directory
specified by $HOME /
NULL, /
file_spec filter /
NULL, /
label of btn1, the Open button,
default is “Open” /
NULL, /
label of btn2, the Cancel button,
default is “Cancel” /
NULL, /
Pt_ARG_FS_FORMAT resource of the
PtFileSel widget, default is “nsd” /
&info, /
PtFileSelectionInfo_t *info
structure, must be specified /
Pt_FSR_CONFIRM_EXISTING |
Pt_FSR_SHOW_HIDDEN |
Pt_FSR_NO_FCHECK /
PtFileSelection flags */
);
if ( k ) {
fprintf( stderr, “\nPtFileSelection failed.” );
PtExit( -1 );
}

if ( info.ret == Pt_FSDIALOG_BTN1 )
fprintf( stderr,
“\nOpen button was pressed. The selected file is:\n\t%s\n”,
info.path );
else
fprintf( stderr, “\nCancel button was pressed.\n” );


return ( Pt_CONTINUE );

}
不知道怎样传递参数

不太懂。这个filesel()是File Selector widget的callback函数吧。

一般是在你的wmclose()里,用PtRealizeWidget()把File Selector显示出来,或者直接用PtSetArgs()修改其参数,而不是直接调用其callback.

如果你一定要调的话,widget 应该是File Selector的widget 指针,apinfo可以直接传下去,cbinfo可以设NULL看看。

多谢唐先生,上面的问题已经清楚了。还有一个问题请教唐先生:
单击File Selector上的open,弹出一个提示框,怎样修改提示框上的文字(包括按钮上的文字)?还有单击右上角的create,弹出一个对话框,上面的文字怎样修改?