home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- View Print Unit
- for
- PowerBASIC
-
-
- by:
- Barry Erick
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PowerBASIC ver 2.0 is missing the View Print command and this
- Unit will allow this command to mimicked. There is only one
- variable that needs to be public in your program so all you need
- to do to use this unit is to add these two lines to a program:
- $LINK "VP1.PBU"
- PUBLIC Vpatr%
-
- You also need, of course, to add the calls to the procedures in
- this .pbu Unit. This is different from the GWBasic View Print,
- where only the top line and bottom line are specified; ViewPrint
- also specifies the left and right coordinates.
-
-
- There are 7 routines in VP1.Pbu. They are:
-
- 1. Function SetVpatr
-
- 2. Procedure GetForeAndBack
-
- 3. Procedure ViewPrint
-
- 4. Procedure ClsVpWind
-
- 5. Procedure Vprint
-
- 6. Procedure VprintCk
-
- 7. Procedure VpLocate
-
- The demo file, VPDemo1.Bas, uses each of these routines in its
- demo. The idea behind using this is to Get the vpatr (or
- attribute) you will use by using the function, SetVpatr and then
- calling ViewPrint to set or clear the window. The other routines
- are to be used while a view port is open. In detail:
-
- Function SetVpatr
- This function returns the attribute of a
- foreground and background color you send it. The
- calling sequence is:
- Vpatr% = SetVpatr%(ForeColor%,BackColor%)
-
- The variable Vpatr% should be used, as this is
- passed to the other routines. This could have
- remained private to the Unit, but the ability to
- work with the attribute in use can be beneficial.
-
- Procedure GetForeAndBack
- This procedure does just the opposite of the
- function SetVpatr. Given the Vpatr%, this returns
- the Foreground% and Background% colors. Call
- using:
- CALL GetForeAndBack(Vpatr%,ForeColor%,BackColor%)
-
-
-
-
-
- - 2 -
-
-
-
-
-
-
-
-
- Procedure ViewPrint
- This procedure should be called once to open the
- view print window or port, and once again to close
- it. It is called with:
- Call ViewPrint(TopRow%,BottomRow%,_
- LeftColumn%,RightColumn%)
-
- Procedure CLSVpWind
- This procedure does a clear screen within the view
- port using the Vpatr% attribute.
- Call ClsVpWind
- There are no parameters with this call.
-
- Procedure VPrint
- This prints a string within the view port.
- Unpredictable results if the string is longer than
- the width of the window.
- Call Vprint(a$)
-
- Procedure VprintCk
- This routine simply places the cursor on the next
- line, scrolling if necessary, and allows you to
- use most PB screen related commands, such as Print
- Using and Input$ within the window.
- Call VprintCk
-
- Procedure VpLocate
- This procedure is analogous to the Locate
- statement but is relative to the view port window
- coordinates.
- Call VpLocate(VPRow%,VpCol%)
- If the parameters are -1, then that parameter
- carries the current CsrLin or Pos. For example:
- Call VpLocate(-1,5)
- indents on the current line to the 5th position.
- By the same token,
- Call VpLocate(2,-1)
- Stays at the same x coordinate and moves to line
- 2.
-
- The author may be contacted via Compuserve (75300,214) or
- GEnie(B.ERICK). PowerBASIC Support on GEnie is in the IBM Product
- Support RT on Page 115, CATegory 5 and on CIS in the IBM Vendor
- product Support Fourm, section 12. Go PCVenB at any prompt.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - 3 -
-
-
-