next up previous contents index
Next: PopupMenu Up: Programming Previous: MessageBox|InputBox|FileDialog   Contents   Index


ModalDialog

Modal dialogs are designed the same way as normal masks. Let's say your designed mask is called "modal1" then the show function is "show_modal1". If you specify "readData", "showData" and "d" from your calling mask the calling mask will be updated even if the modal dialog is shown. If you set these parameters to NULL your calling mask will not be updated as long as the modal dialog is shown.

Figure 6.24: Call ModalDialog
ret = pvRunModalDialog(p,300,200,show_modal1,NULL,
                      (readDataCast) readData,
                      (showDataCast) showData,
                       &d);
/**************************************************
int pvRunModalDialog 
    ( 
      PARAM *p,                          // connection to pvbrowser
      int width,                         // width of modal dialog
      int height,                        // height of modal dialog
      int(*showMask)(PARAM *p),          // mask to show
      void *userData,                    // NULL or userData 
      int(*readData)(void *d),           // NULL or readData from this maks
      int(*showData)(PARAM *p, void *d), // NULL or showData from this mask
      void *d                            // NULL DATA d
    );
**************************************************/

Figure 6.25: Within ModalDialog
case NULL_EVENT:
  readData(&d); 
  showData(p,&d);
  pvUpdateBaseWindow(p);  // update the base window
  break;
case BUTTON_EVENT:
  if(i == 0) return -1;   // The modal dialog box has been closed
  if(i == PushButtonClose) pvTerminateModalDialog(p);
  ...

Figure 6.26: ModalDialog from script language
pvRunModalDialogScript($p,350,275);
$ret = $mask_modal->show($p);
pvTerminateModalDialog($p);

In case of using script languages the base mask is not updated while the modal dialog is shown.



Rainer Lehrig 2004-02-17