next up previous contents index
Next: ModalDialog Up: Programming Previous: OpenGL   Contents   Index


MessageBox|InputBox|FileDialog

This is how standard dialog boxes can be used. The parameter behind "p" is the "id" which will be returned in a event. These id's should be negative in order to distinguish them from normal widgets. Of course for better reading you should make a define for each "id".

pvMessageBox will return a SLIDER_EVENT with the clicked button. The other dialogs will return a TEXT_EVENT.

Figure 6.23: Standard dialog boxes
case BUTTON_EVENT:
  if(i == PushButton1   ) pvInputDialog(p,-1,"Please\ngive me data:", "wastebasket");
  if(i == PushButton4   ) pvFileDialog (p,-2,FileOpenDialog);
  if(i == PushButton5   ) pvFileDialog (p,-3,FileSaveDialog);
  if(i == PushButton6   ) pvFileDialog (p,-4,FindDirectoryDialog);
  if(i == PushButton7   ) pvMessageBox (p,-5,BoxInformation,"a MessageBox\nthis is line2",1,2,3);
  ...



Rainer Lehrig 2004-02-17