how to "catch" the printpreview zoomfactor selected by the user ?

hello,

I want to save the user selected zoomfactor of a printpreview,
to use it the next time the program is started.
Now I can't find an easy/logical way to achieve that.

  # preview action
  def OnMenu_Print_Preview ( self, event ) :
    ....
    printPreview = wx.PrintPreview ( po1, po2, self._printData )
    # set the previous zoomfactor
    printPreview.SetZoom ( self._print_zoom)
    ...
    frame = wx.PreviewFrame ( printPreview, self, "Print Preview " + filename )
    frame.Show ( True )

    # now here I want to catch the user selected zoomfactor
    # ShowModal is not accepted ...

Any suggestions ?

thanks,
Stef Mientki

Stef Mientki wrote:

hello,

I want to save the user selected zoomfactor of a printpreview,
to use it the next time the program is started.
Now I can't find an easy/logical way to achieve that.

# preview action
def OnMenu_Print_Preview ( self, event ) :
   ....
   printPreview = wx.PrintPreview ( po1, po2, self._printData )
   # set the previous zoomfactor
   printPreview.SetZoom ( self._print_zoom)
   ...
   frame = wx.PreviewFrame ( printPreview, self, "Print Preview " + filename )
   frame.Show ( True )

   # now here I want to catch the user selected zoomfactor
   # ShowModal is not accepted ...

Any suggestions ?

You can probably bind a handler for the preview frame's EVT_CLOSE event, and check it there. Don't forget to call event.Skip() so the default handler will still be called.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Stef Mientki wrote:

hello,

I want to save the user selected zoomfactor of a printpreview,
to use it the next time the program is started.
Now I can't find an easy/logical way to achieve that.

# preview action
def OnMenu_Print_Preview ( self, event ) :
   ....
   printPreview = wx.PrintPreview ( po1, po2, self._printData )
   # set the previous zoomfactor
   printPreview.SetZoom ( self._print_zoom)
   ...
   frame = wx.PreviewFrame ( printPreview, self, "Print Preview " + filename )
   frame.Show ( True )

   # now here I want to catch the user selected zoomfactor
   # ShowModal is not accepted ...

Any suggestions ?

You can probably bind a handler for the preview frame's EVT_CLOSE event, and check it there. Don't forget to call event.Skip() so the default handler will still be called.

thanks Robin,
perfect solution !!
cheers,
Stef Mientki