printpreview in a dialog

Frequently asked questions. Look here before posting questions. If you don't find an answer here you can post your question to the most appropriate forum.

printpreview in a dialog

Postby Jan Blok » Mon Apr 06, 2009 11:05 am

To get printpreview in a dialog, two global methods are needed:
Code: Select all
function printPreviewInDialog(formName)
{
   if (application.getApplicationType() == 2) //webclient print == pdf is always opened separate tab/window by browser anyway
   {
      globals.startinprintpreview = formName
      application.showFormInDialog( forms[formName],  -1,  -1,  -1,  -1, "PRINT_TEST",  true,  false,  "printing",  true)
   }
   else
   {
      globals.startinprintpreview = null
      forms[formName].controller.showPrintPreview( true)
   }
}

function checkForPrintPreview()
{
   if (globals.startinprintpreview == currentcontroller.getName())
   {
      currentcontroller.showPrintPreview( true)
      globals.startinprintpreview = 'close_printpreview'
   }
   else if (globals.startinprintpreview == 'close_printpreview')
   {
      if (application.getApplicationType() == 2)
      {
         application.closeFormDialog("printing")
      }
   }
}


If you want to show a printpreview in a dialog call for example: printPreviewInDialog('customer') //customers is form name
In the forms you ever might want to show in printpreview, do in the onShow event a call to checkForPrintPreview()
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Return to FAQ

Who is online

Users browsing this forum: No registered users and 2 guests

cron