PowerBuilder Manual Book Part 6
PowerBuilder Curriculum Part 6
11. Library management
(1), LibraryCreate
Function:
Create an empty PowerBuilder Application Library, And add Library annotations as needed While creating the Application Library
Syntax:
LibraryCreate ( LibraryName{, comments } )
parameter:
LibraryName: String Type, specify the Name Of the Application Library To be created, you can bring the path, And Create the Application Library In the current directory without the path
comments: String Type, optional, specifies the annotations Of the Application Library To be created
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the LibraryCreate() Function returns Null.
usage
the LibraryCreate() Function creates an empty PowerBuilder Application Library (PBL) under the specified path.
If no file extension Is specified when specifying the Application Library Name, the Function automatically adds the extension .PBL.
(2), LibraryDelete
Function:
Deletes the Application Library file Or DataWindow Object In the Application Library.
Syntax:
LibraryDelete ( LibraryName{, objectname, ObjectType } )
parameter:
LibraryName: String Type, specify the Library Name, you can bring the path, If there Is no path, the Application Library will be searched under the System search path
objectname: String Type, optional, specifies the Name Of the Data window Object To be deleted From the Library
ObjectType: LibImportType Type, optional, specifies the Type Of Object To be deleted, currently only supports ImportDataWindow!
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the LibraryDelete() Function returns Null.
usage
When executing the LibraryDelete() Function, If the Last two parameters are Not specified, Then This Function Deletes the specified Application Library;
If the Last two parameters are specified, Then This Function Deletes the specified Data window Object In the specified Application Library. LibraryDelete() Function can only Delete the Data window Object In the Application Library, If you want To Delete Other objects
Then it can only be realized By Using the Library management brush (Library Painter) In the PowerBuilder development environment.
(3), LibraryDirectory
Function:
Get the information list Of the specified Object In the Application Library, including the Object Name, the latest modification Date And Time, And the comment Of the Object.
Syntax:
LibraryDirectory ( LibraryName, ObjectType )
parameter:
LibraryName: String Type, specifies the Name Of the PowerBuilder Application Library, If no path Is specified In the Name, Then This Function searches For the specified file according To the standard file search path Of the operating System
ObjectType: LibDirType Enumeration Type, specify the Object Type you want the Function To list, please refer To usage For valid Values.
Return Value:
the Return Value Is String.
When the Function executes successfully, it returns a String. Each Object occupies one Line, And the information In the Line Is separated By the Tab Character (~t). the Format Of the information In the Line Is: Object Name~tmodification Date/Time~tcomment~nWhen an Error occurs, the Function returns an empty String ("").
If the Value Of Any parameter Is Null, the LibraryDirectory() Function returns Null.
usage
the ObjectType parameter Of the LibraryDirectory() Function Is a quantity Of the LibDirType Enumeration Type, And its valid Value Is
DirAll! Get information about All objects
DirApplication! Get the information Of the Application Object
DirDataWindow! Get information about All Data window objects
DirFunction! Get information about All Function objects
DirMenu! Get information about All menu objects
DirPipeline! Get information about All Data pipeline objects
DirProject! Get the information Of the project Object
DirQuery! Get information about All query objects
DirStructure! Get information about All structure objects
DirUserObject! Get information about All user objects
DirWindow! Get information about All window objects Using
After the LibraryDirectory() Function obtains the Name Of the specified Object, modification Date/Time, And possible comments, the Application can either use the Pos() Function To locate And split the String, Or use the ImportString() Function Of the Data window To display the result In the In the Data window.
(4), LibraryExport
Function:
Unloads an Object From the specified Application Library In the Format defined By the Object's syntax
Syntax:
LibraryExport ( LibraryName, objectname, ObjectType )
parameter:
LibraryName: String Type, specify the Name Of the Application Library To remove the Object From, If no path Is specified In the Name, Then the Function will
the operating System's standard file search path to find the specified file
objectname: String Type, specifying the Name Of the Object To be removed
ObjectType : LibExportType Enumeration Type, specifying the Type Of Object To be exported, please refer To usage For specific Values
Return Value:
the Return Value Is String.
When the Function Is successfully executed, the Syntax Of the specified Object Is returned. This Syntax Is the same as the Syntax When Using the Library Painter To remove the Object. the difference Is that the LibraryExport() Function omits the header Of the removal Syntax. If an Error occurs, the Function returns an empty String ("").
If the Value Of Any parameter Is Null, the LibraryExport() Function returns Null.
usage
Possible Values For the ObjectType parameter Of LibraryExport() are:
ExportApplication! Application Object
ExportDataWindow! Data window Object
ExportFunction! Function Object
ExportMenu! Menu Object
ExportPipeline! Data pipeline Object
ExportProject! Project Object
ExportQuery! query Object
ExportStructure! structure Object
ExportUserObject! User Object
ExportWindow! window Object
(5), LibraryImport
Function:
Load the Data window Object expressed In Syntax Format Into the specified Application Library
Syntax:
LibraryImport(LibraryName, objectname, ObjectType, Syntax, errors{, comments })
parameter:
LibraryName: String Type, specify the Name Of the Application Library To Move the Object Into, If no path Is specified In the Name, Then This Function searches For the specified file according To the standard file search path Of the operating System
objectname: String Type, specify the Name Of the Data window Object To be Moved Into
ObjectType: LibImportType Enumeration Type, which specifies the Type Of Object To be imported. Currently, This Function only supports ImportDataWindow!, which means that only Data window objects can be imported Into the Application Library
Syntax: String Type, specifies the Syntax To Move Into the Data window Object
errors: String Type variable, used To Save Error information when an Error occurs
comments: String Type, optional, used To specify the annotations Of the Moved Object
Return Value:
the Return Value Is Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the LibraryImport() Function returns Null.
Usage when the Application program dynamically creates the Data window Object during Running, you can use the LibraryImport() Function To Save the definition Of the Dynamic Data window Object To the Application Library, And Then you can use the Object directly.
12. Print
(1), Print
Function:
Print one Or more lines Of Text In an Open Print job In the current font
Syntax:
Print(printjobnumber,{tab1,}String{,tab2})
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
tab1: Integer Type, optional, specify the Position Where the Text starts To Print, And Move the Print Cursor To This Position before starting To Print the String, counting From the Left Border Of the Print area, In thousandths Of an inch.
If the Print Cursor Is already at the specified Position, Or the Print Cursor has exceeded the specified Position, Or This parameter Is omitted, Then the Print() Function starts printing From the current Position Of the Print Cursor
String: String Type, specify the String To be printed. If the String contains carriage Return And Line feed characters (~r~n), the String will be divided Into multiple lines Of output, but, except For the First Line, Other lines ignore the initial printing Position specified By the tab1 parameter
tab2: Integer Type, optional, specifies the Position Where the printing Cursor moves after the String Is printed, counting From the Left Border Of the printing area, And the unit Is one-thousandth Of an inch.
If the Print Cursor has exceeded the specified Position, Then the Print() Function ignores This parameter, And the Print Cursor Is at the End Of the printed String. If This parameter Is omitted, the Print() Function moves the Print Cursor To the beginning Of the Next Line.
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the Print() Function returns Null.
usage
In a Print job, PowerBuilder uses a Print Cursor To track the Print Position. the Print Cursor holds the coordinates Of the Upper Left corner Of the area To be printed.
after Using the Print() Function To Print Text, PowerBuilder automatically updates the Print Cursor.
PowerBuilder uses Line Spacing To determine the distance Between two lines Of Text printed out. the Line Spacing Is proportional To the Height Of characters. the Default Line Spacing Is 1.2 times the Height Of characters.
Line Spacing can be changed Using the PrintSetSpacing() Function.
When the Print() Function prints the output On the Next Line, it sets the X coordinate Of the Print Cursor To 0, And the Y coordinate increases the Value indicated By the current Line Spacing.
Since the Print() Function automatically adjusts the y-coordinate Position Of the printing Cursor every Time a Line Is printed, This Function automatically handles paging, so the Application does Not need To Call the PrintPage() Function For paging.
the printing area Is determined By the physical size Of the paper And the Border Space. the PrintSend() Function can Send the ESC Control sequence Of the specific printer. Using This Function, the size Of the Border Space can be changed.
In addition, before printing begins, use the PrintDefineFont() And PrintSetFont() functions To change the font used By Print().
(2), PrintBitmap
Function:
Prints a bitmap at a specified Position In the Print area
Syntax:
PrintBitmap ( printjobnumber, bitmap, X, Y, Width, Height )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
bitmap: String Type, specify the file Name Of the bitmap file To be printed
X: Integer Type, specifying the x-coordinate Of the starting printing Position Of the bitmap, In thousandths Of an inch
Y: Integer Type, specifies the Y coordinate Of the starting printing Position Of the bitmap, In thousandths Of an inch
Width: Integer Type, specifies the printing Width Of the bitmap, In thousandths Of an inch. If the Value Of This parameter Is specified as 0, the original Width Of the image will be printed
Height: Integer Type, specifies the printing Height Of the bitmap, In thousandths Of an inch. If the Value Of This parameter Is specified as 0, the original Height Of the image will be printed
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintBitmap() Function returns Null.
Usage After executing the PrintBitmap() Function, the Position Of the printing Cursor remains unchanged, And remains at the Position before executing the Function.
(3), PrintCancel
Function:
Cancel a Print job started With the PrintOpen() Function
Syntax:
PrintCancel ( printjobnumber )
parameter:
printjobnumber: the job Number Of the Print job To Cancel
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of the parameter printjobnumber Is Null, the PrintCancel() Function returns Null.
usage
the PrintCancel() Function cancels the specified Print job, deletes the corresponding Print pool file, And closes the Print job. Therefore, after the Application executes the PrintCancel() Function, it does Not need To Execute the PrintClose() Function To Close the Print job.
(4), PrintClose
Function:
Close the print job And send the printed page to the printer
Syntax:
PrintClose ( printjobnumber )
parameter:
printjobnumber: the job number of the print job to Close
return value:
The return value is Integer. The function returns 1 on success And -1 on error.
If the value of the parameter printjobnumber is Null, the PrintClose() function returns Null.
usage
After an application starts a print job with the PrintOpen() function, it must Close the print job with PrintClose() after the print task is complete, Or cancel the print job with the PrintCancel() function as needed
(5), PrintDataWindow
Function:
Print the content Of the Data window Control, use This Function To Print the content Of multiple Data window controls In one Print job, And each prints From a new page
Syntax:
PrintDataWindow ( printjobnumber, dwcontrol )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
dwcontrol: the Name Of the Data window Control Or sub Data window Control whose content Is To be printed
Return Value:
the Return Value Is Integer. the Function returns 1 On success And -1 On Error.
If the Value Of the parameter printjobnumber Is Null, the PrintDataWindow() Function returns Null.
usage
the Application program can Print the contents Of multiple Data windows In one Print job By executing the PrintDataWindow() Function multiple times, And each Data window starts printing From a new page.
When the presentation Style Of the Data window Is RichTextEdit, each row In the Data window starts printing On a new page.
It should be noted that the PrintDataWindow() Function uses the font And Style defined By the Data window itself When printing the Data window, And the font defined For the current job By Using the PrintDefineFont() And PrintSetFont() functions does Not work.
(6), PrintDefineFont
Function:
Define the font used By the Print job, PowerBuilder supports eight fonts For each Print job.
Syntax:
PrintDefineFont(printjobnumber, fontnumber, FaceName, Height, Weight, FontPitch, FontFamily, Italic, Underline)
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
fontnumber: Specifies the Number assigned To the currently defined font, valid Values are Between 1 And 8
FaceName: String Type, specify the font Name, the font should be a font supported By your printer, such as "Arial"
Height: Integer Type, use a positive Value To specify the Height Of the font, In thousandths Of an inch;
use a negative Value To specify the font point, For example, -18 means 18 points. In general, it Is more accurate To use points
Weight: specify the point size Of the font, the normal font Is 400 points, And the Bold Type Is 700 points
FontPitch: FontPitch Enumeration Type, specifying the font standard. valid Values are:
Default! - the Default Value;
Fixed! - Fixed form;
Variable! - Variable form
FontFamily: FontFamily Enumeration Type, specifying the font family. valid Values are: AnyFont!, Decorative!, Modern!, Roman!, Script!, Swiss!
Italic: Boolean Type, specify whether To use Italic Style. valid Values are: True - use Italic Style;
False - Do Not use Italic Style. the Default Value Is False
Underline: Boolean Type, Specifies whether To add an Underline. valid Values are: True - Underline;
False - no Underline. the Default Value Is False
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintDefineFont() Function returns Null.
Usage In one Print job, the Application can Define up To 8 fonts at the same Time.
When the Application needs To use more fonts, you can use the PrintDefineFont() Function To Replace the font corresponding To the font Number With Other fonts after Using a certain font Number To output the content.
(7), PrintLine
Function:
Draw a Line With a specified thickness On the current printed page
Syntax:
PrintLine ( printjobnumber, x1, y1, x2, y2, thickness )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
x1: Integer Type, specifying the x-coordinate Of the starting point Of the Line, In thousandths Of an inch
y1: Integer Type, specifies the Y coordinate Of the starting point Of the Line, In thousandths Of an inch
x2: Integer Type, specifying the x-coordinate Of the End point Of the Line, In thousandths Of an inch
y2: Integer Type, specifies the y-coordinate Of the End point Of the Line, In thousandths Of an inch
thickness: Integer Type, specifies the thickness Of the Line, In thousandths Of an inch
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error. If the Value Of Any parameter Is Null, the PrintLine() Function returns Null.
usage
After the Application executes the PrintLine() Function, This Function does Not change the Position Of the printing Cursor
(8), PrintOpen
Function:
Start a Print job And Return the job Number
Syntax:
PrintOpen( { jobname } )
parameter:
jobname: String Type, optional, specifies the Name Of the Print job To be opened, which will be displayed In the Print manager window
Return Value:
the Return Value Is Long.
the Function returns the Print job Number when the Function executes successfully, And returns -1 when an Error occurs.
If the Value Of Any parameter Is Null, the PrintOpen() Function returns Null.
usage
After the Application program executes the PrintOpen() Function, it starts a new Print job And feeds the paper To the Next page, And sets the Default font Of the printer as the font Of the Print job.
the Position Of the Print Cursor Is at the Upper Left corner Of the Print area.
Other printing functions In the same Group use the job Number returned By the PrintOpen() Function To identify the job.
it should be noted that After Using the PrintOpen() Function To Open the Print job And Using Other functions In the same Group To complete the Print job, you must use PrintClose() To Close the Print job, Or use the PrintCancel() Function To Cancel the Print job as needed.
(9), PrintOval
Function:
Draws an ellipse Or circle at a specified Position With a specified Line Width
Syntax:
PrintOval ( printjobnumber, X, Y, Width, Height, thickness )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
X: Integer Type, specifying the x-coordinate Of the Upper Left corner Of the ellipse Or circle, In thousandths Of an inch
Y: Integer Type, specifying the y-coordinate Of the Upper Left corner Of the ellipse Or circle, In thousandths Of an inch
Width: Integer Type, specifies the Width Of the ellipse Or circle outline, In thousandths Of an inch
Height: Integer Type, specifies the Height Of the ellipse Or circle outline, In thousandths Of an inch
thickness: Integer Type, specifies the thickness Of the Outer edge Of the ellipse Or circle, In thousandths Of an inch
Return Value:
the Return Value Is Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintOval() Function returns Null.
usage
After the Application executes the PrintOval() Function, This Function does Not change the Position Of the printing Cursor.
the ellipse Or circle drawn By the PrintOval() Function Is solid, that Is To say, After executing This Function, the Text Or image under the ellipse Or circle will be completely covered.
If you want To output Text Or graphics In an ellipse Or circle, the Application should First Draw the ellipse Or circle, And Then use Other functions To output Text Or graphics In the ellipse Or circle
(10), PrintPage
Function:
Sends the current page To the printer Or Print pool And starts a new Print page In the current Print job
Syntax:
PrintPage ( printjobnumber )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintPage() Function returns Null
(11), PrintRect
Function:
Prints a rectangle at a specified Position With a specified Line Width
Syntax:
PrintRect ( printjobnumber, X, Y, Width, Height, thickness )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
X: Integer Type, specifying the x-coordinate Of the Upper Left corner Of the rectangle, In thousandths Of an inch
Y: Integer Type, specifies the Y coordinate Of the Upper Left corner Of the rectangle, In thousandths Of an inch
Width: Integer Type, specifies the Width Of the rectangle, In thousandths Of an inch
Height: Integer Type, specifies the Height Of the rectangle, In thousandths Of an inch
thickness: Integer Type, specifies the thickness Of the edge Of the rectangle, In thousandths Of an inch
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintRect() Function returns Null.
usage
After the Application executes the PrintRect() Function, This Function does Not change the Position Of the printing Cursor.
the PrintRect() Function draws a solid rectangle, that Is To say, After executing This Function, the Text Or image below the rectangle will be completely covered.
If you want To output Text Or graphics In a rectangle, the Application should Draw the rectangle First, And Then use Other functions To output Text Or graphics In the rectangle.
(12), PrintRoundRect
Function:
Print a rounded rectangle at a specified Position With a specified Line Width
Syntax:
PrintRoundRect(printjobnumber,X,Y,Width,Height,xradius,yradius,thickness)
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
X: Integer Type, specifying the X coordinate Of the Upper Left corner Of the rounded rectangle, In thousandths Of an inch
Y: Integer Type, specifies the Y coordinate Of the Upper Left corner Of the rounded rectangle, In thousandths Of an inch
Width: Integer Type, specifies the Width Of the rounded rectangle, In thousandths Of an inch
Height: Integer Type, specifies the Height Of the rounded rectangle, In thousandths Of an inch
xradius: Integer Type, specifying the X radius Of the rounded part Of the rounded rectangle, In thousandths Of an inch
yradius: Integer Type, specifying the y-radius Of the rounded part Of the rounded rectangle, In thousandths Of an inch
thickness: Integer Type, specifies the thickness Of the edge Of the rounded rectangle, In thousandths Of an inch
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintRoundRect() Function returns Null.
usage
After the Application executes the PrintRoundRect() Function, This Function does Not change the Position Of the printing Cursor.
the PrintRoundRect() Function draws a solid rounded rectangle, that Is To say, After executing This Function, the Text Or image under the rounded rectangle will be completely covered.
If you want To output Text Or graphics In a rounded rectangle, the Application should Draw the rounded rectangle First, And Then use Other functions To output Text Or graphics In the rounded rectangle.
(13), PrintScreen
Function:
Print screen image In Print job
Syntax:
PrintScreen ( printjobnumber, X, Y {, Width, Height } )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
X: Integer Type, specifies the x-coordinate Of the Upper Left corner Of the screen image To be printed On the printed page, In thousandths Of an inch
Y: Integer Type, specifies the Y coordinate Of the Upper Left corner Of the screen image To be printed On the printed page, In thousandths Of an inch
Width: Integer Type, optional, specifies the Print Width Of the screen image, In thousandths Of an inch. If This parameter Is omitted, PowerBuilder prints the screen image at the original Width Of the screen. If This parameter Is specified, the Height parameter must also be specified
Height: Integer Type, optional, specifies the Print Height Of the screen image, In thousandths Of an inch. If This parameter Is omitted, PowerBuilder prints the screen image at the original Height Of the screen
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintScreen() Function returns Null.
(14), PrintSend
Function:
Send an arbitrary String directly To the printer, typically used To Send the printer's control codes
Syntax:
PrintSend ( printjobnumber, String {, zerochar } )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
String: String Type, specify the String sent To the printer. In This String, use the ASCII code Value Of the non-printing Character To represent the non-printing Character
zerochar: Integer Type, optional, specifies the ASCII code Value used To represent the Value 0 In the String parameter. Valid Values are Between 1 And 255
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintSend() Function returns Null.
usage
the Application program can use the PrintSend() Function To directly Send Control sequences (escape code sequences) To the printer, For example, To Set the intensity Of the printed Text, the margins around the printed page, And so On.
Different types Of printers use Different Control sequences, so you'll need to check your printer manual.
Since PowerBuilder ends each Character String With a Value Of 0 (that Is, a Character whose ASCII code Is 0), If the Print Control sequence contains a Value Of 0, the Application needs To use Other characters To Replace the Value Of 0 In the parameter String, And specify it With the zerochar parameter This substitution Character.
In general, a Character that Is Not used In printer Control sequences should be chosen as a substitute For a Character With a Value Of 0.
typically, Print jobs are organized In the following Order:
1. use the PrintOpen() Function To Open the Print job
2. use the PrintSend() Function To Set printer characteristics, such as printing direction, margins, etc.
3. use the PrintDefineFont() And PrintSetFont() functions To Set the font used By the Print job
4. use Other functions In This Group To Print out Text Or graphics 5. Execute the PrintClose() Function To Close the Print job
(15), PrintSetFont
Function:
Sets the font used By the current Print job
Syntax:
PrintSetFont( printjobnumber, fontnumber )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
fontnumber: Specifies the font Number Of the font used By the Print job. This Number should correspond To the Number defined In the PrintDefineFont() Function. the valid Value Of the font Number Is Between 1 And 8, And 0 means To use the Default font Of the printer.
Return Value:
Return Value: Integer.
When the Function executes successfully, it returns the Height Of the current font, And When an Error occurs, it returns -1.
If the Value Of Any parameter Is Null, the PrintSetFont() Function returns Null.
(16), PrintSetSpacing
Function:
Sets the Line Spacing factor that will be used By the Print Function To determine Line Spacing
Syntax:
PrintSetSpacing( printjobnumber, spacingfactor )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
spacingfactor: Specify the Line Spacing factor, expressed In multiples Of the Character Height, the Default Value Is 1.2
Return Value:
Return Value: Integer.
the Function returns 1 On success And -1 On Error.
If the Value Of Any parameter Is Null, the PrintSetSpacing() Function returns Null.
usage
In the PowerBuilder Application program, the Line Spacing Is proportional To the Height Of the Character, And the Default Value Is 1.2 times the Height Of the Character.
When the Print Group Function generates a new Line, the System automatically Sets the X coordinate Position Of the printing Cursor To 0, And the Y coordinate Position increases the current Line Spacing Value On the original basis.
Use the PrintSetSpacing() Function To change the Line Spacing Of the current Print job.
(17), PrintSetup
Function:
Open the printer settings dialog
Syntax:
PrintSetup ( )
return value:
Return value: Integer.
The function returns 1 on success And -1 on error.
If the value of any parameter is Null, the PrintSetup() function returns Null.
usage
When multiple printers are installed In the system, In Windows 95, the PrintSetup() function opens the dialog box shown In Figure 2-1, click the "Setup" button to Set various features of the printer.
If there is only one printer In the system, directly Open the print setting dialog box of the printer.
It should be noted that, In versions after Windows95 And Windows NT 3.51, the printer settings Set Using the PrintSetup() function only work For the current application And do Not affect the printer settings of other applications.
For Windows 3.1, printer settings Set Using the PrintSetup() function affect All applications In the system
(18), PrintText
Function:
Print a Line Of Text at the specified Position
Syntax:
PrintText ( printjobnumber, String, X, Y {, fontnumber } )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
String: String Type, specify the Text To be printed
X: Integer Type, specifies the x-coordinate Of the Position Where the Text starts To Print, In thousandths Of an inch
Y: Integer Type, specifies the y-coordinate Of the Position Where the Text starts To Print, In thousandths Of an inch
fontnumber: an optional parameter, specifying the font Number used For printing Text, which Is determined By the PrintDefineFont() Function. When This parameter Is omitted, the Text Is printed In the Print job's current font
Return Value:
Return Value: Integer.
When the Function executes successfully, it returns the X Position Of the printing Cursor after the Text Is printed, that Is, the Value Of the parameter X plus the Width Of the printed Text.
returns -1 On Error.
If the Value Of Any parameter Is Null, the PrintText() Function returns Null.
(19), PrintWidth
Function:
Determines the Width Of a Character String In the specified Print job according To the current font, In thousandths Of an inch
Syntax:
PrintWidth ( printjobnumber, String )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
String: String Type, specify the String whose printing Width Is To be determined
Return Value:
Return Value: Integer.
When the Function executes successfully, it returns the Print Width Of the Character String calculated By the current font, In thousandths Of an inch. When an Error occurs, it returns -1.
If the Value Of Any parameter Is Null, the PrintWidth() Function returns Null.
(20), PrintX
Function:
Returns the x-coordinate Position Of the Print Cursor
Syntax:
PrintX ( printjobnumber )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
Return Value:
Return Value: Integer.
When the Function executes successfully, it Returns the x-coordinate Position Of the printing Cursor In thousandths Of an inch, And Returns -1 When an Error occurs.
If the Value Of Any parameter Is Null, the PrintX() Function Returns Null.
(21), PrintY
Function:
Returns the y-coordinate Position Of the Print Cursor
Syntax:
PrintY ( printjobnumber )
parameter:
printjobnumber: Print job Number opened With the PrintOpen() Function
Return Value:
Return Value: Integer.
When the Function executes successfully, it Returns the y-coordinate Position Of the printing Cursor In thousandths Of an inch, And Returns -1 When an Error occurs.
If the Value Of Any parameter Is Null, the PrintY() Function Returns Null.
PowerBuilder Manual Book Part 7Â ClickHere
Good Luck!