home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pmrepo.zip
/
MANUAL.DOC
next >
Wrap
Text File
|
1994-08-22
|
9KB
|
257 lines
Very Important note: Please don't display this file in the report control
as it contains embeded codes used only for illustration and can render
the document unreadable.
Summary
=======
Report is a Presentation Manager control that eases the process of creating
formatted output reports. This control takes its input from an ASCII
text file, and produces a report on screen or sends it to the printer. The
input file can have many formatted styles. To center a line, a simple
command like {align_center} will cause the line to be centered.
Report treats each input line as a paragraph. A paragraph is defined as
any input line terminated by a CR/LF combination. The paragraph can not
exceed 4096 characters. This relieves the programmer from having to write
to the GPI and provides him/her with very powerful text formatting options
available only in major word processors.
Usage
=====
The programmer typically creates the report mechanically thru a series
of printf statements and embeds all necessary control codes in the file.
A window of the report class is then created and the text file is passed to it.
The report control paginates and displays the text to the screen or prints it
to the printer.
Control Styles
==============
Upon control creation several styles can be specified. The RS_DRAFTMODE
ignores all character formatting embedded in the file and uses the default
printer font and point size. This leads to maximum printing speed. This style
effects screen previewing which displays the file ignoring all embedded
fonts,styles and point sizes.
Embedded Codes
==============
The following is a list and the explanation of all the codes that can be
embedded in the text file. Note that embedded codes are case insensitive. They
must be surrounded by braces {code <parameters>} They also carry on to the
next paragraph. If bold_on is specified on the first paragraph, the whole
file will be bold unless it was turned off by inserting a bold_off code.
Paragraph settings Default
------------------ -------
align_right align_left
align_left
align_center
Tabs
====
This control supports four different styles of tabs. left, Right, Center and
decimal tabs. Up to 10 different tab positions can be set for a paragraph.
The tab definitions are carried over to the next paragraph. Tab positions are
defined using the {def_tabpos position,type} token where position is the number
of inches from the left margin. Type can have four different values:
1,2,3,4 for Left,Right,Centered and Decimal tabs respectively.
The following demonstrates a left tab at 2.5":
{def_tabpos 2.5,1}
The following demonstrates a Centered tab at 4.5":
{def_tabpos 4.5,3}
It is very important to note that tabs carry over to the next paragraph.
To delete a tab stop, the (delete_tabstop tab position) must be used.
Fonts
=====
This control supports the fonts built into any printer specified. In addition,
support for screen and downloadable fonts. There are several commands that
can be specified to manipulate fonts and syles.
{font facename}
---------------
This command sets the current font. The parameter should be a Face name
string that does not contain any compound styles. For example,
{font Helvetica} sets the current font to Helvetica. Whereas specifying
{font Helvetica Bold}, the results will be UNPREDICTABLE. In order to obtain
the Bold Style, use the {bold_on}/{bold_off} styles. To specify Helvetica Bold,
use : {font Helvetica}{bold_on}. The Control defaults to "Times New Roman"
if an invalid font was supplied or no matching screen font exist.
The following styles can be used:
Styles
------
{underline_on/off}
{bold_on/off}
{italic_on/off}
{strikeout_on/off}
Point Size
==========
This control allows yopu to set the point size from 1 to 255 points.
It uses scalable fonts to display text on the screen and render them to the
printer. The fonts are scaled on the fly and can be printed to any
printer supported by PM. A point is 1/72 of an inch or 20 twips.
{pointsize 48} will scale the current font to 48 points
{pointsize 12} will restore the point size to 12 points.
Position Commnads
=================
{pagebreak}
-----------
If a paragraph contains this token, a new page is inserted and the current
paragraph is made the first one on the new page. For example in the
following input:
Tester
Hello Word{pagebreak}
"Tester" is placed in a separate page from "Hello World".
Control Messages
================
RM_SETFILE
----------
This message loads the file specified in mp1. If mp1 is NULL, the contents
of the control are cleared.
RM_QUERYFILE
------------
Returns the currently loaded filename in the buffer pointerd to by mp1.
RM_SETMARGINS
-------------
Low word of mp1 has left margin size
High word of mp1 has Right margin size
Low word of mp2 has Top margin size
High word of mp2 has Bottom margin size
This messages sets the margins of the document pages. All these measurments
are in twips. An inch is 1440 twips. Repagination of the document is
invoked whenever the margins are altered. The default margin size is 1/2"
an inch. If the margins exceed the page width a FALSE will be returned.
Otherwise a TRUE will be returned.
RM_QUERYMARGINS
---------------
Caller should pass a pointer to an array of 4 elements of USHORT size.
The call returns the margins in the following order:
1) Left margin
2) Right margin
3) Top margin
4) Bottom margin
Please note that all measurments are in twips. This message always returns
TRUE.
RM_SETPRINTER
-------------
This call resets the printer to the one specified by caller. If caller
passed a DevOpenStruc in mp1, then the window will use that information
and sets the page size according to the form currently set by the
printer driver. If NULL was specified, then the default installed printer is
used. Repagination is invoked after printer has been changed.
If the printer info passed is not valid a FALSE will be returned.
Otherwise a TRUE will be returned.
RM_SETMARGINVIEW
----------------
Toggles margin view state. If mp1 is TRUE, margins are made visible otherwise
they are made invisible. Note that margins are never printed.
RM_QUERYMARGINVIEW
------------------
Returns the current margin view. TRUE is enabled FALSE otherwise.
RM_SETCURRENTPAGE
-----------------
Brings into view the page specified in Low word of mp1. Several predefined
constants can be used in place of the page number.
PAGE_TOP,PAGE_BOTTOM,PAGE_NEXT,PAGE_PREVIOUS. This function returns the
current visible page or -1 if an error occured.
RM_QUERYCURRENTPAGE
-----------------
This message returns the current visible page.
RM_QUERYPAGECOUNT
-----------------
This message returns the number of pages.
RM_QUERYPAGESIZE
-----------------
This message returns the page dimention. mp1 and mp2 should contain pointers
to ULONGS. *mp1 and *mp2 will be filled with the page width and height
respectively.
WM_CONTROL
----------
Many WM_CONTROL notification mesages are sent to the owner of the control.
These are used to signal the owner of some event. The following are
events:
mp1 has Control ID in Low word of mp1 and notification code in the high
word.
mp2 has a certain value depending on the notification code.
Notification codes
==================
RN_ERROR
--------
This notification code is usualy generated by the helper threads. This is their
way of communicating error messages with invoker. mp2 has the error ID.
ERROR_MEMORY Memory Error
ERROR_SYSTEM System Errors. Win/Gpi/Dos errors
ERROR_TAB Can not insert more Tabs
ERROR_POINTSIZE Point size is 0
Control Creation:
----------------
PM Report is a regular PM control. It needs to be registered and then
created using WinCreateWindow. The following Code demonstrate creation:
// Register the control Class
RptRegisterClass(hab);
// Create the window
hwndReport = WinCreateWindow(hwnd,
szReportClass,
(PSZ) "",
WS_VISIBLE,
0,
0,
0,
0,
hwnd,
HWND_TOP,
10,
NULL,
NULL);
// Load a text file into it
WinSendMsg(hwndReport,
RPM_SETFILE,
MPFROMP("report.doc"),
NULL);