Printing Samples

Hi

1) I also tested previewframe.MakeModal(True).
It does not help. It seems, the previewframe class
behaves a bit different from a normal frame. It has the
member Initialize(), that a 'normal' frame have not.

2) I also noticed, that when lauching a preview from
a button or a menu, the previewframe becomes the
active window. But, if you launch the preview "from
within the code", the main frame stays the active window.

eg.
def preview(...)
    #code

In the following code, the preview is shown and becomes
the active window, system.menu and [X] button are
working fine.

class MyFrame(wxFrame):

    def __init__(self, parent, id):
        wxFrame.__init__(self, parent, id, 'preview',
wxPoint(720, 120), wxSize(200, 100))
        self.pa = wxPanel(self, -1, wxDefaultPosition,
wxDefaultSize)
        b1 = wxButton(self.pa, 1001, "preview", wxPoint(20,
20), wxDefaultSize)
        wx.EVT_BUTTON(self, 1001, self.OnClick1)

        wx.EVT_LEFT_DOWN(self, self.OnCloseWindow)
        wx.EVT_CLOSE(self, self.OnCloseWindow)

    def OnCloseWindow(self, event):
        self.Destroy()

    def OnClick1(self, event):
        preview(self)

but in the following code, I got the run time error.

class MyFrame(wxFrame):

    def __init__(self, parent, id):
        wxFrame.__init__(self, parent, id, 'preview',
wxPoint(720, 120), wxSize(200, 100))

        preview(self)

        wx.EVT_LEFT_DOWN(self, self.OnCloseWindow)
        wx.EVT_CLOSE(self, self.OnCloseWindow)

    def OnCloseWindow(self, event):
        self.Destroy()

3) In order to prevent a user from quitting the preview with
the system menu or with the [X] button, you can
define the preview frame like this:

sty = wxCAPTION | wxFRAME_NO_TASKBAR
previewframe = wxPreviewFrame(printpreview, parent,
'.: Print preview :.', style = sty)

Con: you can not resize the preview frame.

Sorry, I cann't help more.

Jean-Michel Fauth, Switzerland