WPCubed Product Support

How to enable buttons on twpPreviewDlg

I asked this question about a month ago, but it must have been overlooked.

I'm using a twpPreviewdlg, and want to allow the user to setup a printer and print. I must be misunderstanding how to do this. The following doesn't do it. I do get a several unlabeled buttons top left.

I'm using the twppreviewdlg so I don't have to create a form.

dlg := TWPPreviewDlg.Create(nil); 
  with dlg do begin 
    DisabledDialogs := DisabledDialogs-[wpdiaPrint,wpdiaPrinterSetup,wpdiaSaveAsPDF]; 
    ViewOptions := ViewOptions + [wpShowCR,wpShowFF,wpShowNL,wpShowSPC,wpSHowHardSPC]; 
    SinglePageMode := True; 
    EditBox     := RT;
    rt.availabledialogs :=[wpStartPrint,wpdiaPrint,wpdiaPrinterSetup,wpdiaSaveAs,wpdiaSaveAsPDF,wpdiaFind,wpdiaPageSetup] ; 
    windowstate := wsmaximized; 

    dlg.Execute; 
    dlg.Free; 
  end;
#1 ♥ 0
13k Views 1 links 5 users read 4 min
support

Print and setup printer is usually enabled.

This is my TWPPreviewObject in my demo:

object WPPreviewDlg1: TWPPreviewDlg
  EditBox = WPRichText1
  ViewOptions = [wpHideSelection, wpDisableMisspellMarkers, wpDontGrayHeaderFooterInLayout]
  Modal = False
  DefaultLeft = 10
  DefaultTop = 10
  DefaultPosition = poScreenCenter
  DefaultWidth = 319
  DefaultHeight = 426
  MinHeight = 220
  MinWidth = 220
  ZoomMode = wpPvFullWidth
  WindowState = wsMaximized
  DisabledDialogs = [wpStartPrint, wpStartSave, wpdiaLoad, wpdiaCanClose, wpStartNewDocument, wpdiaThesaurus, wpdiaFind, wpdiaReplace]
  SinglePageMode = True
  Left = 366
  Top = 226
end
#2 ♥ 0

Print and setup printer may usually be enabled, but they are not for me. I have a row of square buttons on the upper left that show outlines when I mouse over them, but no icons or captions.

I've stepped through WPPrvFrm in the debugger. btnPrint.Visible is True when dia.ShowModal is called. I think my problem isn't so much visibility as setting up the buttons. No icon, no caption on the button in the preview form.

One odd thing I see in the debugger is that the following code is apparently not active (no blue dots). Please note that I HAVE enabled the define in the .inc file {$DEFINE WP6}.

{$IFDEF WP6} 
    if SecOptionIsSet(FEditBox.SecurityOptions, wpSecNoSaveDialog) then
    begin
      dia.btnSavePDF.Visible := false;
      dia.btnSaveExport.Visible := false;
    end else
{$ENDIF}
#3 ♥ 0

I emailed a very small sample project just now that shows the problem.

Jeremy

#4 ♥ 0

I am seeing the exact same problem with the print preview dialog not having any glyphs or captions on the buttons.

#5 ♥ 0

Jeremy, fwiw, I got this problem worked around in my install.
D2010 wptools 6.14.
I used the solution for wptools 5 at this post:
[](http://wpcubed.com/forum/viewtopic.php?t=5470&highlight=print+preview+buttons)
Made a backup of the wpprvfrm.dfm file in my D2010 wptools source folder and replaced with the downloaded file. I rebuilt the project and the close, print, and print setup buttons now have images.

Julian will have to confirm if this is a valid fix for version 6 or not. It's working for me.
-damon

#6 ♥ 0
support

Hi,

thats fine. It was just the DFM file which was broken. I included the new DFM in the latest setup - at least it should be there.

Julian

#7 ♥ 0

Hi Julian. I just upgraded my version and the glyphs in the preview form are missing. The source files I can find are dated 27-10-2009 so it seems that the mentioned updated dfm-file has passed me by. .. or perhaps the files found are not used in building the component

Can I download it separatly, do you have an alternative fix or will it be in the next update?

.. A follow up. I tried the WP5 solution and it worked. My problem's solved and I assume that following updates contain the proper images.

#8 ♥ 0

These components and forms can be used to build a print preview for the contents of a TWPRichText or TDBWPRichText component.

A memo control to edit formatted text. A toolbar, ruler and/or preview can be easily attached to it and the word processor is complete. Enhanced features such as transparency and tiled background images are also supported. TWPRichText is completely independent of the Win95 RTF component!
Headers and footers are supported at preview - and print time. Both can be edited in the same TWPRichText control or assigned from another source. Fields like 'PAGENUMBER' are supported!

:roll:
John Galt
The Definitive Source For Building your Ambit Business.

#9 ♥ 0

I'll fix it the usual way, still hoping it'll be fixed in future updates.

#10 ♥ 0
This category is archived. No new posts are possible.