xsharp.eu • Passing Fox arrays by ref or value - Page 3
Page 3 of 3

Passing Fox arrays by ref or value

Posted: Mon Nov 01, 2021 4:14 pm
by robert
Karl-Heinz,
I am not sure why you really want to write your own printer dialog.
I think that most users would be perfectly happy with the normal printer dialog that is shown by the .net PrintDialog class.
this has a property button and everything you could ever want.
You can also enable / disable the various print range options with the properties on that class:
printdlg.png
printdlg.png (9.43 KiB) Viewed 2035 times

Code: Select all

VAR dlg := PrintDialog{}           
    dlg:AllowSelection := TRUE
    dlg:AllowSomePages := TRUE
    dlg:ShowDialog()

Robert

Passing Fox arrays by ref or value

Posted: Tue Nov 02, 2021 7:13 am
by Karl-Heinz
Robert,

since the APrinters()/Getprinter() internals are similar, and the .net PrintDialog can´t be customized to get the VFP look i tried it this way. But it´s ok, to stay with the .net Printdialog.

regards
Karl-Heinz

Passing Fox arrays by ref or value

Posted: Tue Nov 02, 2021 7:35 am
by robert
Karl-Heinz

VFP is 12 years old (at least). Why would you try to customize the dialog to look like an antique dialog, unless you're an archelogist ?

Robert

Passing Fox arrays by ref or value

Posted: Wed Nov 03, 2021 1:36 pm
by Karl-Heinz
Robert,

The .net PrintDialog caption shows "Print", which i translate to: The intention is to print something after clicking the [Ok] button, and not to select a Printername only like the VFP GetPrinter() does. I think in the terms of VFP the GetPrinter() is used in this way:

Code: Select all

c = GetPrinter()

if ! empty ( c ) 
   SET PRINTER TO NAME ( c ) 	

endif


Anyway, from my side the case is closed !

regards
Karl-Heinz

Passing Fox arrays by ref or value

Posted: Wed Nov 03, 2021 3:35 pm
by Karl-Heinz
Robert,

after reading your reply once again, I still don't understand why you call me an "archelogist" when I try to point out possible VFP compatibility problems. If you don't like such reports, please say it loud so I don't waste my time any longer!

regards
Karl-Heinz

Passing Fox arrays by ref or value

Posted: Wed Nov 03, 2021 4:19 pm
by robert
Karl-Heinz,

I am sorry if I have offended you. That was never my intention.
What I tried to say was that we should not spend too much time to create exactly the same dialog that VFP has, when there is already a built-in dialog in Windows that you can call from C# which also has more functionality (like access to the properties dialog).
By using the built-in dialog we will also "automatically" get new features when they arrive with updates of the OS.

And I do not think that FoxPro has created a complete new dialog. I am pretty sure that the underlying code uses the
PrintDlgA () function in the windows API and all they have done is to pass in PRINTDLGA structure that contains a a handle to a custom resource.

The rest is driven by the normal PrintDlgA() function.

You can see that resource if you open VFP9ENU.DLL in Visual Studio (with Open / File) and then expand the Dialog node in the resource viewer. The resource with number 1559 is the one that contains the dialog.
As you can see in the image below they have moved the properties button outside of the visual area of the dialog, as well as the choices for paper size and source and orientation.
printdlg.png
printdlg.png (10.74 KiB) Viewed 2035 times
I think if we want to do something similar we should use the standard print dialog and use a similar trick to send in a different template.

Robert

Passing Fox arrays by ref or value

Posted: Wed Nov 03, 2021 4:35 pm
by Chris
Hi Karl-Heinz,

Sorry for stepping in, but please be assured that Robert was joking, it was not meant in an offensive way at all. I know, in written text it's hard to tell intent sometimes, but knowing Robert in person well, I know he is typing/saying it in a light-hearted way.

.

Passing Fox arrays by ref or value

Posted: Thu Nov 04, 2021 12:02 pm
by Karl-Heinz
ok, may love and peace reign again ;-)

Karl-Heinz

Passing Fox arrays by ref or value

Posted: Thu Nov 04, 2021 2:23 pm
by Chris
Karl-Heinz wrote:ok, may love and peace reign again ;-)
:)