Hi,
i remember that when programming for Windows i used the MessageBox function,which blocked my application until the user made his/her choice.
So,that function returned only after this choice.
Now i'm using the QuestionDialog widget in motif,and i would like to have that behaviour:is there some easy way to do that?
I need this blocking capability because what i need is:
1)i want to copy/transfer several selected files to another location
2)if a file with the same name exists on the destination path,the application will popup the classic question dialog asking if the user wants to replace the file or not
What i am actually doing is:
1)i use a XmList containing the files in the source path
2)when the user selects the "copy" button i do the following:
XmString *sTable;
XmString askedQuestion;
char question[256];
int cnt;
char* selectedFile;
XmString *strlist;
XtVaGetValues(_logEventFileList,XmNselectedItemCount,&cnt,XmNselectedItems,&strlist,NULL);
cout<<"selected "<<cnt<<" elements"<<endl;
//For each selected file popup a question dialog (which is the member variable _dialogConfirm)
while(cnt--)
{
if(!(selectedFile=(char *)XmStringUnparse(strlist[cnt],
XmFONTLIST_DEFAULT_TAG,
XmCHARSET_TEXT,
XmCHARSET_TEXT,
NULL,0,
XmOUTPUT_ALL)))
break;
cout<<selectedFile<<endl;
//Not performing the check if the file exists on the destination right now
//Just trying to make a dialog appear for each selected file
sprintf(question,"A file named %s already exists./n/nWhat do you want to do?",selectedFile);
askedQuestion=XmStringCreateLocalized (question);
XtVaSetValues(_dialogConfirm, XmNmessageString, askedQuestion,NULL);
XtManageChild(_dialogConfirm);
XmStringFree(askedQuestion);
}
XtUnmanageChild(_dialogConfirm);
As you can see,i tried to do it with XtManageChild,but it returns immediately,so i don't see any dialog.
So,making the dialog modal doesn't help me...