Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print button on preview toolbar
Message
From
18/01/2005 10:23:47
 
 
To
18/01/2005 02:01:13
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00977969
Message ID:
00978092
Views:
27
>How to disable print button on report preview toolbar in VFP9?

In VFP 9, you have a lot more control over the appearance and behavior of the preview window and toolbar because they're VFP classes. The following code, taken from Chapter 7 of the upcoming What's New in Nine (available from Hentzenwerke Publishing), shows an example. The ExtenstionHandler class is needed to remove the Print function from the shortcut menu; otherwise, the Print button would be removed by setting its Visible to .F. but the user could still choose Print from the shortcut menu.
loListener = createobject('ReportListener')
report form MyReport preview object loListener nowait
loExtension = createobject('ExtensionHandler')
loListener.PreviewContainer.SetExtensionHandler(loExtension)
loListener.PreviewContainer.oForm.Toolbar.cmdPrint.Visible = .F.

define class ExtensionHandler as Custom
  function AddBarsToMenu(tcMenu, tnNextBar)
    release bar 12 of &tcMenu
  endfunc

  function Release
    if type('This.PreviewForm') = 'O'
      This.PreviewForm.ExtensionHandler = .NULL.
      This.PreviewForm = .NULL.
    endif type('This.PreviewForm') = 'O'
  endfunc

  function Show(tnStyle)
  endfunc

  function Paint
  endfunc

  function HandleKeyPress(tnKeyCode, tnShiftAltCtrl)
  endfunc
enddefine
Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform