Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The Width statement
#1
Since QB64pe has declared full functional QB45 compatible I have posted this snippet:

The QB45 contains Width with Device$

Code: (Select All)
' sample program to set Width statements.
Dim screenwidth As Integer
Dim screenheigth As Integer

Dim widthx As Integer
widthx = 80

screenwidth = 80
screenheight = 25

' reset file width
filenumber = FreeFile
Open "tempfile.xyz" For Output As #filenumber
Width #filenumber, widthx

' reset some printers
Width "lpt1:", widthx
Width "lpt2:", widthx
Width "lpt3:", widthx

' resets some drvies
Width "cons:", widthx
Width "scrn:", widthx

' reset lprint
Width LPrint widthx

' reset screen
'PRINT screenwidth, screenheight
Width screenwidth, screenheight
End

Where:

Code: (Select All)
WIDTH Statement Details  
    
Syntax  
   WIDTH [columns][,lines]  
   WIDTH {#filenumber | device},width  
   WIDTH LPRINT width  
    
Both files and devices can be assigned an output-line width.  
    
  Syntax                    Description  
  WIDTH [columns][,lines]   Sets the number of columns and lines to  
                            display on the screen.  
    
                            The value of columns must be either 40 or  
                            80. The default value is 80.  
    
                            The value of lines may be 25, 30, 43, 50,  
                            or 60, depending on the display adapter  
                            used and the screen mode (see the SCREEN  
                            statement help topic for more information).  
                            The number of lines displayed when the program  
                            started will determine the default value.  
    
  WIDTH #filenumber,width   Sets the line width of an output device opened  
                            as a file (for example, LPT1: or CONS:).  
    
                            The filenumber argument is the number  
                            associated with the file in the OPEN  
                            statement.  
    
                            This form permits altering the width while  
                            a file is open, since the statement takes  
                            place immediately.  
    
  WIDTH device,width        Sets the line width of device (a device file  
                            name).  
    
                            The device should be a string expression  
                            (for example, "CONS:").  
    
                            Note that this width assignment is deferred  
                            until the next OPEN statement affecting the  
                            device; the assignment does not affect output  
                            for an already open file.  
    
  WIDTH LPRINT width        Sets to width the line width of the line  
                            printer, for use by subsequent LPRINT  
                            statements.
Reply
#2
Hi Eric,

A lot has changed with the switchover from parallel port printers to USB ones. I, for one, miss the ability to use printer escape codes. I mean we can still use LPRINT CHR$(12) to eject a page, but there used to be settings for width, margins, fonts, color, etc. I can't remember if maybe we had one big gain with the ability to send images to the printer, for instance a signature. I think Rob worked on that. 

Yeah, width is not supported for LPRINT in QB64, along with FRE and a few other things like inline functions DEF FN I believe it was called. I don't know if there is enough interest to pursue them, as DEF FN can be easily replaced with actual functions, FRE is not really needed as memory constraints have been removed. Things like CLEAR 200, 0, 0 to clear the stack are not required, etc.

As for printing today, I personally, I do all mine by converting the file itself to .rtf format and slaving it out to wordpad.

Well, I'm sure a few of the developers will read your post and add to the discussion.

Pete

Oh, here is the one I was thinking about: https://qb64phoenix.com/forum/showthread...04#pid3904
Reply
#3
https://qb64phoenix.com/qb64wiki/index.p...ed_by_QB64

https://qb64phoenix.com/qb64wiki/index.php/LPRINT



Assumes a 80 character wide page. WIDTH LPRINT is not supported in QB64.
Reply
#4
(04-05-2024, 05:30 AM)SMcNeill Wrote: https://qb64phoenix.com/qb64wiki/index.p...ed_by_QB64

https://qb64phoenix.com/qb64wiki/index.php/LPRINT



Assumes a 80 character wide page. WIDTH LPRINT is not supported in QB64.
Steve meant: Assumes an 80, not a 80.

Big Grin Big Grin Big Grin Boy we're having fun today!
Reply
#5
Quote:Assumes a 80 character wide page. WIDTH LPRINT is not supported in QB64.
That is strange : I just entered:

  Width Lprint 80

and it took..

Even if the Wiki said no..
Reply
#6
Maybe change it to width lprint 40, and see if it still defaults to 80?

Pete
Reply
#7
From what I recall -- and it's been ages since I last tried to use LPRINT (why should I use LPRINT when we have PrintImage??) -- it doesn't matter what you set for Width LPrint.  It's 80.   Only 80.  Always 80.   QB64 doesn't support Width LPrint, and as the wiki states:  it defaults to 80.  (The standard width of a SCREEN 0 screen.)

I don't think you'll ever be able to set it to anything else, but if you can, I'd love to hear about it.  Big Grin
Reply
#8
You might try WIDTH #filenumber, width and then using PRINT to print to a file, which you can later use Notepad or some other such tool to print to the drive.
Reply
#9
Quote:Since QB64pe has declared full functional QB45 compatible I have posted this snippet:

in your dreams maybe, where are you getting this idea from? @eoredson

fYi qb64pe does not do dos, i know, hard to get over that fact. Smile
b = b + ...
Reply
#10
Quote:in your dreams maybe, where are you getting this idea from?
https://en.wikipedia.org/wiki/QB64

From the Wiki:

QB64's syntax is designed to be completely backwards compatible with QuickBASIC.

I didn't write this I only know what I have been told Big Grin
Reply




Users browsing this thread: 1 Guest(s)