Re[2]: Problem printing text with wxWidgets 3.2.2.1

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On Wed, 20 Sep 2023 12:00:02 +0200 Fulvio Senore wrote:

FS> 
FS> 
FS> Il 18/09/2023 23:35, Vadim Zeitlin ha scritto:
FS> 
FS> > FS> The user's code is almost surely inside a class: just derive the user's
FS> > FS> class from the printing class, add the PrintPage() implementation and
FS> > FS> call the Print() method.
FS> > 
FS> >   Again, I don't really understand how is this different from deriving it
FS> > from wxPrintout?
FS> > 
FS> 
FS> For example, let's say that I want to print three lines of text at a 
FS> size of 10 points.
FS> 
FS> It is a trivial task that now requires to:
FS> - set a printer up
FS> - create a new class derived from wxPrintout
FS> - find a way to make a 10 point text print as 10 point (something like 
FS> black magic) in this new class
FS> - make available the text to this class
FS> - print the text in the printout class
FS> 
FS> With my proposal the task would require to:
FS> - derive the current class also from the new printing class (just a few 
FS> chars since there is multiple inheritance)
FS> - add a PrintPage() method that prints the rows
FS> - call the inherited Print() method
FS> 
FS> Again, the main advantage is not having to do with the printout concept 
FS> and all the black magic needed to make it work.

 Sorry, I am not convinced at all. The main (only?) difference is "find a
way to make a 10pt text print as 10pt" but you don't tell how is it going
to work in the second case. Surely if we can find a way to work in it, we
could make it work with wxPrintout too? And, of course, it would be great
if we could do it (and I think we should be able to), but this doesn't seem
to require any new API.

 I.e. I think your class (how would you call it, BTW?) just seems much
simpler than wxPrintout to you because you came up with this idea, but to
me it seems exactly the same as a combination of wxPrinter and wxPrintout,
i.e. it looks potentially even complicated.

 Or, IOW, your class could be implemented by just inheriting from the
existing wxPrintout. In fact, I'd encourage you to try doing it like this
and see what does it give. If the resulting API is simpler we could well
call this wxSimplePrintout or something like this and include it in wx.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
              https://www.tt-solutions.com/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZRb04AAKCRAG6kHeT2we
hg1zAJ9th4nZ7yWK2/4xbd6Rstz3qlb6vwCfYXjxTTpuMgwUDjjHgmOkL4VlRIc=
=2r8n
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.