Topic: select a printer

Hi,
Is there away to select a printer or another fortran device  in a user dlg?
In CVF there was an procedure called  prt_nav(IOunit,object) is it possible to make some similar?

Other question:
the function dlgrequestselection contains only 6 items. Is it possible to make on containing 10 or more items with a variable string length?

Regards Klaus

Re: select a printer

Klaus Asmus wrote:

Hi,
Is there away to select a printer or another fortran device  in a user dlg?
In CVF there was an procedure called  prt_nav(IOunit,object) is it possible to make some similar?

No, we don't have a dialog that can select an alternate output unit that is pre-built.  You could write one that offered a list of units to the user to select, but one is not built in.  Additionally, you might also run into issues trying to access a printer directly from Fortran.

I couldn't find any reference, however, to prt_nav anywhere.  Do you have a link to the documentation for it?

Klaus Asmus wrote:

Other question:
the function dlgrequestselection contains only 6 items. Is it possible to make on containing 10 or more items with a variable string length?

I think I understand what you're asking here.  Technically, the dlgrequestselection dialog allows unlimited items.  However, it might not be drawing a scroll bar in all cases, which would be a bug.  I'm looking into it right now.

Jeff Armstrong
Approximatrix, LLC

Re: select a printer

Klaus,

Simply Fortran 2.32, when released, will have a fixed dlgrequestselection function that should display a scrollbar in a dropdown list if a large number of choices are requested.

Jeff Armstrong
Approximatrix, LLC

Re: select a printer

Jeff,
good to hear about the dropdown list in SF3.32!

I will try to get more info for you regarding the printing procedure, may be tomorrow.
one has to use a CVF lib:

Use Fortran_WinPrint       (May be I can send a copy of that lib...)

istat=  Print_Unit(IO_PR,Default_Printer=.FALSE., Font="Verdana"   ) with optionally some more parameters to open a dialog

at the end one has to close that fortran unit.



regards, Klaus

by the way, there is also a app called Printdlg in windows but without any description

Re: select a printer

Here more about printing in CVF:
There is a module in CVF6.1 called  Fortran_Winprint.f90;
the comment text in the file is explaining more.
In general one has to use this module by the use statement in a procedure where a print order follows:
Use Fortran_WinPrint
…...            
For printing one has to define a Fortran unit ; for example by my selfmade dialog:
call prt_nav(......)
If is decided to sent output to a printer, a Fortran unit has to be opened ; in my case called IO_PR
Next all print instructions has to be sent to that unit   …...

use after all printer output the function Print_Unit from Fortran_WinPrint like :
istat=  Print_Unit(IO_PR,Default_Printer=.FALSE., Font="Verdana")
see there are  more optional parameters!
close (IO_PR) …...Don't forget to close (conditional) the PRN-device after all the print output is finished

The source of Fortran_Winprint.f90 is sent separately by mail and I hope that you can use it in any way

regards, Klaus

Re: select a printer

Klaus,

The CVF example relies heavily on CVF's implementation and wrapping of the Windows API, which we don't support.  In fact, their code wouldn't technically work on 64-bit machines because of their assumption that a memory pointer can be represented as an INTEGER(KIND=4)

If I understand you correctly, you're attempting to print text to a printer directly? There are probably some drastically less complicated techniques possible, such as writing a temporary file and sending it to be printed without trying to directly use the Windows API.  I'll see if I can think of a solution.

Jeff Armstrong
Approximatrix, LLC

Re: select a printer

Can you not just open a file named LPT1\\ for writing?

--
David

Re: select a printer

David, did you try it?
I found that the file name LPT1 is not accepted and the \\ will cause an error.
Of course one may give a print file any legal file name but it doesn't mean that it will be sent to a printer in Your network. You have to connect it to a specific printer.
Klaus