Results 1 to 1 of 1
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 ...
- 03-13-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 9
Blocking message box in Motif
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?
Before you wonder about modality.....
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:
As you can see,i tried to do it with XtManageChild,but it returns immediately,so i don't see any dialog.Code: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);
So,making the dialog modal doesn't help me...
Thanks in advance!


Reply With Quote