Classes
dc_help()............A context help system based on a Web Browser
dc_printer().........A Printer class for @..SAY style printing
dc_html()............A base class for creating any HTML element
dc_htmlbody()........A class for creating an HTML body tag
dc_htmlbrowse()......A class for creating a BROWSE in HTML
dc_htmlcheckbox()....A class for creating a CHECKBOX in HTML
dc_htmlcolumn()......A class for creating a BROWSE COLUMN in HTML
dc_htmlcombobox()....A class for creating a COMBO BOX in HTML
dc_htmlform()........A class for creating FORM tags in HTML
dc_htmlframe().......A class for creating FRAME tags in HTML
dc_htmlframeset()....A class for creating FRAMESET tags in HTML
dc_htmlget().........A class for creating a GET in HTML
dc_htmlhyperlink()...A class for creating HYPERLINK tags in HTML
dc_htmlimage().......A class for creating IMAGE tags in HTML
dc_htmlinput().......A class for creating an HTML input tag
dc_htmllist()........A class for creating a LIST in HTML
dc_htmllistitem()....A class for creating LIST ITEMS in HTML
dc_htmlmain()........A class for creating the main HTML document
dc_htmlmle().........A class for creating a MEMO window in HTML
dc_htmlradiobutton().A class for creating a RADIO BUTTON in HTML
dc_htmlsay().........A class for creating a SAY in HTML
dc_htmltabgroup()....A class for creating TABPAGES in HTML
dc_htmltable().......A class for creating a TABLE in HTML
dc_htmlvars()........A class for managing HIDDEN variables in HTML
dc_settimerevent()...Set a Timer Event
dc_help()
A context help system based on a Web Browser
Syntax:
Documentation is not completed.
See the source code.
Description:
DC_Help is a class that is used for general help and context-specific
help.
Features:
1. Help Window runs in another thread and receives help request
messages from all other windows in all other threads.
2. Context links via help codes on each application object allow the
user to select the level of help he/she wants.
F1 Help - Place the mouse over an object in the application and press
F1 to display help in the help window.
Click Help - Click the mouse on any object in the application and the
help window automatically updates to show help for the clicked object.
Motion Help - Move the mouse over any object in the application and the
help window automatically updates to show help for the object.
TreeView Help - Expand the tree in the left side of the help window to
display help for any object in the application or any general help.
3. Help can be stored as text or as HTML containing JavaScript, VBscript,
AXPScript or XPPScript.
4. Help screens can look exactly like any web page and can contain
hyperlinks to anywhere on the World Wide Web or any other help screen.
5. Web Browser messages are dispatched to another thread that allows for a
new kind of hyperlink for running any procedure or for jumping to any other
help screen. With some imagination, the help system could become the entire
application and could launch new windows. Examples of thie capability are
in the HELP database in the XDEMO.EXE program.
6. A find index and a print system make it easy to find help or print a set
of documentation.
Source/Library:
_DCXHELP.PRG, DCHELP.DLL
dc_printer()
A Printer class for @..SAY style printing
Syntax:
DC_Printer():new( { < cPrinterName >, ;
< nFrom >, ;
< nTo >, ;
< nRows >, ;
< nCols >, ;
< nCopies >, ;
< lSelection >, ;
< lCollate >, ;
< lToFile >, ;
< aPaperSize >, ;
< ocFont >, ;
< oFontDlg >, ;
< lFixed >, ;
< lPixel >, ;
< lPreview >, ;
< aViewPort >, ;
< lAllPages >, ;
< cOutFile >, ;
< lTextOnly >, ;
< nUnits >, ;
< nZoomFactor >, ;
< nScrollFactor >, ;
< nCol >, ;
< nRow >, ;
< nWidth >, ;
< nHeight >, ;
< lDefault >, ;
< bHandler >, ;
< lEnableFont >, ;
< nOutFileMode >, ;
< nOrientation >, ;
< cComment >, ;
< cPort >, ;
< cStatus >, ;
< nMargin >, ;
< cTitle >, ;
< lStopEject >, ;
< lHide >, ;
< nPaperBin >, ;
< nFormSize >, ;
< lPrintButton >, ;
< lCancelDialog >, ;
< cBusyMsg >, ;
< lForceDlg >, ;
< lAutoEject >,;
< lCopyLoop >, ;
< nDialogStyle >, ;
< lPrintGrid >, ;
< nDuplexMode >, ;
< nColorMode >, ;
< nResolution > } ) - > oPrinterObject
Returns:
An object.
Description:
DC_PRINTER() is a custom class which is used to create
reports that use row/column addressing identical to the
@..SAY addressing used by Clipper. This class provides
for an easy migration of existing reports so that they
may use the more powerful features of the Windows print
manager like font selection and selection of a network
printer.
The printer class allows for both text-based coordinates
and pixel-based coordinates in the same print project.
This allows for existing Clipper reports to be embellished
with graphics, lines, font-changes, etc. without requiring
the writing of an entirely new report.xxxx
Exported Instance Variables:
Name Type Description
----------- ------- --------------------------------
:nProw N Current Printer row
:nPcol N Current Printer column
:lActive L Printer object has been created
:cargo X Reserved for user
:nFrom N From (start page), 0 if all pages
:nTo N To (end page), 0 if all pages
:nCopies N Print copies
:oPS O Presentation Space object
:oFont O Font object
:nRows N Print rows
:nCols N Print columns
:lFixed L Print fixed (non-proportional) columns
:cFont C Font Compound Name
:lPixel L Use Pixel-based coordinates
:aPageSize A Page size array. Default is :oPS:setPageSize()[1]
:lCollate L Collate
:lSelection L Selection
:lToFile L Print to File
:lPreview L Preview Mode
:lTerminated L Print has been terminated
:aBuffer A Preview buffer (contains data about pages
previously previewed).
:nZoomFactor N A number from -10 to +10 (default is 2)
:nCurrPage N Current page being printed
:cOutFile C Name of Output file (Text Only mode)
:lTextOnly L Sending output to text file
:lAutoScale L Default bitmap printing to AUTOSCALE
:nScrollFactor N Sets the sensitivity of the preview window
scrollbars. Default is 40.
:bEventHndlr B A code block that is evaluated between events
in the previewer event loop.
:oDC O This is the XbpPrinter() object when output
is sent to printer. It is the XbpDialog() object
when output is sent to the Preview Window.
:cPort C The name of the printer output port
:cPrinterName C The name of the printer device
:cComment C The comment returned by selected printer
driver.
:cStatus C The status of the selected printer.
:nMargin N The left print margin
:nUnits N The unit of the coordinate system.
Default is GRA_PU_LOMETRIC (Units are 0.1
millimeter).
:nFormSize N The form size. Default is XBPPRN_FORMSIZE_LETTER.
:nPaperBin N The paper bin.
:lStopEject L Stops the print job on an EJECT when previewing.
:lCancelDialog L Displays a cancel button during printing.
:aPaperSize A The printer paper size array from oDC:papersize().
:nResolution N The printer resolution from oDC:setResolution()
:nColorMode N The printer color mode from oDC:setColorMode()
:nDuplexMode N The printer duplex mode from oDC:setDuplexMode()
:lCopyLoop L Copy Loop Mode is enabled.
:nDialogStyle N The dialog style.
:lPrintGrid L GRID mode is enabled.
Methods:
:NEW( <þaOptions )
Creates a new instance of the DC_PRINTER class.
<þaOptionsþ> is an single-dimensional array of printing options.
Element Type Description
--------- ------ -------------------------------------------
1 C Printer Name (if empty, a printer dialog
will appear to choose a printer and other
options).
2 N From (first page #)
3 N To (last page #)
4 N Rows (number of print rows) default is 66
5 N Cols (number of print cols) default is 80
6 N Copies (number of copies to print) default
is 1.
7 X Spare
8 L Collate (default is .F.)
9 L Print to file (default is .F.)
10 A Page Size (an array of 2 elements) default
is ::oPS:setPageSize().
11 C/O Font. May be a character string with a
Font name or a font object. Default is
12.Courier.
12 X Spare
13 L Fixed. If .TRUE. (default), will print each
character in fixed columns (even when using
proportional fonts). IF .FALSE. will print
characters in the same proportion as the
chosen font.
14 L Pixel. If. .TRUE., then coordinates will be
pixel-based, otherwise they will be text-
based.
15 L Preview. If .TRUE. then the report will be
displayed in a window on the screen rather than
sent to the printer.
16 A ViewPort. This optional array contains a set
of four coordinates equivalent to the ViewPort.
See XbpPresSpace():viewport for more info.
17 L lAllPages. If .TRUE. will disable the users
selection of pages to print in the printer
dialog window.
18 N cOutFile. This is the name of the file to
output the print when the <þlTextOnlyþ> or the
<þlToFileþ> parameter is used. If the <þlToFileþ>
parameter is used the value "FILE:" will prompt
the user for a file name.
19 L lTextOnly. If .TRUE. will output the report in
text-only mode. The user will be prompted for the
name of a text file to create unless the <þcOutFileþ>
parameter is used. Only text commands will be
processed.
20 N nUnits. Optionally sets the units for the
coordinate system of the presentation space. The
default unit is pixel. To define a different unit,
a #define constant must be passed for <þnUnitsþ> .
The following table lists the valid constants for
<þnUnitsþ> .
Constant Description
GRA_PU_ARBITRARY Any unit. The coordinate system
is scaled to the viewport.
GRA_PU_PIXEL Unit is a pixel
GRA_PU_LOMETRIC * Unit is 0.1 millimeter
GRA_PU_HIMETRIC Unit is 0.01 millimeter
GRA_PU_LOENGLISH Unit is 0.1 inch
GRA_PU_HIENGLISH Unit is 0.01 inch
GRA_PU_TWIPS Unit is 1/1440 inch
*) Default value
21 N nZoomFactor. This is a numeric value to use as the
base for the initial zoom value of the Preview
window. This clause is used only in PREVIEW mode.
The default is zero. A higher number will cause
the text and graphics in the screen to be larger.
The minimum value is .25. The default value is
1.00.
22 N nZoomIncr. This is a numeric value specifying the
zoom resolution. A smaller number will cause each
click of the ZOOM+/ZOOM- key to have a smaller
change. The default value is .25.
23 N nScrollFactor. This is used to set the sensitivity
of the scroll bars. The default is 40.
24/25 N nStartCol, nStartRow. These are the starting
coordinates of the PREVIEW window (in pixels)
relative to the left, bottom of the screen. The
default is 10,10.
26/27 N nPreWidth, nPreHeight is the width and height of
the PREVIEW window (in pixels). If no size is
given then the window will be automatically sized
to fit the screen.
28 L lUseDefault. If .TRUE. will send the print job to
the currently selected Windows default printer
driver without displaying a Printer dialog window.
29 B bHandler, This is a codeblock to evaluate in the
event loop of the preview window. This gives the
programmer control over previewing operations.
The DC_Printer() object is passed as a parameter
when evaluating the code block. A numeric value
is returned from the code block:
VALUE FUNCTION
------------------ -----------------------------------------
DCGUI_NONE Normal operation
DCGUI_IGNORE Ignore this event (do not handle it)
DCGUI_EXIT_OK Exit the event loop and return control
to printing loop.
DCGUI_EXIT_ABORT Exit the event loop and set the ::terminated
flag of the DC_Printer() object to abort
the print routine.
30 L lFontButton. A .TRUE. will enable the FONT button
on the Printer dialog for the operator to select a
font for the print job.
31 N nOutFileMode. 0 - If file exists, ask user if
overwrite is ok.
1 - Overwrite always
2 - Append to any existing file.
32 N nOrientation. 1 - Portrait, 2 - Landscape.
33 Reserved
34 Reserved
35 Reserved
36 N nMargin. The amount of spaces to pad to the
left of each printed column. The default is 0.
37 C cTitle. This is the title to display in the
title bar area of the Preview window and the
Printer Dialog window. This is also the name
of the print job that is sent to the spooler.
38. L lStopEject. This will cause an automatic stop
of program execution each time a DCPRINT EJECT
command or oPrinter:eject() method is
encountered in the program. The control will
then be given to the event loop of the PREVIEW
window. If lStopEject is .FALSE. then the
control will only be given to the PREVIEW window
when the command DCPRINT OFF or the function
DC_PrinterOff() are encountered in the program.
39. L lHide. This will hide the previewer window
until the command DCPRINT OFF or the function
DC_PrinterOff() are encountered in the program.
If lHide is .FALSE., each page will be visible
in the preview window as they are being created.
40. N nPaperBin. This is used to instruct the printer
which paper bin to use for the print job. A
#define constant from XBPDEV.CH must be used for
<þnPaperBinþ> . Valid constants have the prefix
XBPPRN_PAPERBIN_.
41. N nFormSize. This is used to instruct the printer
what paper format is being used. Common formats
are Letter, Legal or A4. They are selected by
their numeric ID which is available as a #define
constant from XBPDEV.CH. Valid constants have
the prefix XBPPRN_FORMSIZE_.
42. L lPrintButton. This will enable a 'Print' button
on the preview window thereby enabling the
ability to print while previewing.
43. L lCancelDialog. This will display a dialog window
during printing that includes a CANCEL button to
cancel the print job.
44. C cBusyMsg. This is a message to display while
each screen is being created. Use this clause
if your application takes a long time to create
a screen.
45. L lForceDialog. This will force the Printer Dialog
window to be displayed even if <þlUseDefaultþ> is
.true.
46. L lAutoEject. This will cause an automatic
page eject whenever an attempt is made to
print past the last print row defined by the
SIZE <þnRowsþ>, <þnColsþ> command or whenever an
attempt is made to print to a row that is
higher on the page than the last printed row.
This feature is provided for compatability
with existing Clipper reports.
47. L lCopyLoop. This is used to disable the
sending of the request to the print driver to
print multiple copies. If the user selects
copies from the print dialog screen the value
selected will be placed in the oPrinter:nCopies
variable and the programmer must used this
value in a FOR..NEXT loop to print multiple
copies.
48. N nDialogStyle. This allows users of eXPress++
1.3 and earlier versions to display the same
style dialog in their 1.5 applications as was
displayed in 1.3. Xbase++ 1.5 introduced a new
XbpPrinterDialog() class which was incorporated
in eXPress++ 1.5. This new dialog is created by
the print driver whereas the old dialog was
created by eXPress++ and also included a FONT
button for selecting a print font. Dialog
style DCPRINT_DIALOG_EXPRESS will display the
1.3 style printer dialog.
49. L lPrintGrid. This will print a cross-hatch
grid on the paper or preview window at each
text-based row and column defined by the SIZE
clause. The grid will also include row/column
numbers at the top and left border. The GRID
option will aid in the designing of reports.
50. N nDuplexMode. This is used to set the duplex
mode for double-sided printing. The mode is
selected by a numeric ID which is available
as a #define constant from XBPDEV.CH. Valid
constants have the prefix XBPPRN_DUPLEXMODE_.
51. N nColorMode. This is used to set the color
mode for printing. The mode is selected by a
numeric ID which is available as a #define
constant from XBPDEV.CH. Valid constants
have the prefix XBPPRN_COLORMODE_.
52. N nResolution. This is used to set the
resolution for printing. The mode is selected
by a numeric ID which is available as a
#define constant from XBPDEV.CH. Valid
constants have the prefix XBPPRN_RESOLUTION_.
Returns a DC_Printer object.
---------------------------------------------------------------
:SETPAGESIZE ( <þaPageSizeþ> )
Sets the page size.
<þaPageSizeþ> determines the page size in the presentation space
of the printer. This parameter must be an array containing two
elements that specify the dimensions of the page in the x and y
directions (X = width, Y = height).
Each unit, or pixel, represents .1 millimeters on the page.
-----------------------------------------------------------
:BITMAP ( <þnSrowþ>, <þnScolþ>, <þnErowþ>, <þnEcolþ>, <þncResþ>,;
[<þlAutoScaleþ>], [<þlCenterþ>] )
Prints on Bitmap on the page.
<þnSrowþ>, <þnScolþ>, <þnErowþ>, <þnEcolþ> are the page coordinates to
print the bitmap. These are row/column text coordinates unless
the <þpixelþ> argument was passed to :NEW() as a .TRUE. when the
printer object was created, then they are pixel coordinates.
<þncResþ> is the name of a .BMP file or the number of a bitmap
resource that has been linked to the application.
<þlAutoScaleþ> will automatically scale the bitmap within the
coordinates to maintain the aspect ratio.
<þlCenterþ> will center the bitmap within the coordinates.
Returns a logical .TRUE. if the bitmap was printed
otherwise returns a .FALSE.
-----------------------------------------------------------
:ATSAY ( [<þnRowþ>], [<þnColþ>], <þxTextþ>, [<þlTrueTypeþ>], [<þlPixelþ>],;
[<þlFixedþ>], [<þocFontþ>], [<þaAttrþ>], [<þnCodePageþ>], ;
[<þnAlignþ>], [<þlOutlineþ>] )
Prints text on the page at a specified row/column.
<þnRowþ>, <þnColþ> are the start page coordinates to print the
text. These are row/column text coordinates unless the <þpixelþ>
argument was pass to :NEW() as a .TRUE. when the printer
object was created or the <þlPixelþ> argument is passed as a
.TRUE. to the :ATSAY() method. If <þnRowþ> and <þnColþ> are passed
as NIL arguments, the current pen location will be used rather
than a fixed row/column location. Use NIL arguments for row/column
when printing concatenated text with different fonts or colors.
<þxTextþ> may be any variable.
<þlTrueTypeþ> if .TRUE. prints as true-type.
<þlPixelþ> if .TRUE. assumes coordinates are pixel-based otherwise
they are text-based.
<þlFixedþ> if .TRUE. will draw each character onto the "grid" of the
presentation space defined by the rows and columns parameter.
This is for columnar reports where characters must be aligned
non-proportionally regardless of the font chosen.
<þocFontþ> is the font to use. This may be a character string with
a font compound name or a font object.
<þaAttrþ> is an attribute array that conforms to the specifications
for GraStringAt() attributes.
<þnCodePageþ> is the code page to use with the selected font.
<þnAlignþ> is used to justify the text left, center or right
both vertically and horizontally. <þnAlignþ> is a summation of
define manifest constants from DCPRINT.CH:
Constant Description
---------------------- --------------------------------------
DCPRINT_ALIGN_LEFT Justify Left (Default)
DCPRINT_ALIGN_BOTTOM Justify Bottom (Default)
DCPRINT_ALIGN_RIGHT Justify Right
DCPRINT_ALIGN_HCENTER Justify Horizontally Centered
DCPRINT_ALIGN_TOP Justify Top
DCPRINT_ALIGN_VCENTER Justify Vertically Centered
<þlOutlineþ> if .TRUE. will draw a box around the text. The
default is .FALSE.
Returns NIL
-----------------------------------------------------------
:QOUT ( xText )
Prints text on the page at the start of the next line after
the current row/column.
<þxTextþ> may be any variable.
Returns NIL
-----------------------------------------------------------
:QQOUT ( xText )
Prints text on the page at the current row/column.
<þxTextþ> may be any variable.
Returns NIL
-----------------------------------------------------------
:EJECT ()
If the ::lPreview instance variable is set to .F., this method
Ejects the printer paper, starts a new page and sets the
printer row/column to 0,0. If the ::lPreview instance variable
is set to .T., a dialog box will be displayed with a prompt
for the operator to continue or abort the remaining output.
Returns NIL
-----------------------------------------------------------
:DESTROY()
Destroys the printer object.
Returns NIL
-----------------------------------------------------------
:SETFONT( <þocFontþ>, [<þnCodePageþ>] )
Sets a new font
<þocFontþ> is a character string containing the Font Compound
Name or a font object.
<þnCodePageþ> is the code page to use with the selected font.
Returns the previous font object.
-----------------------------------------------------------
:GETFONTOBJECT ()
Get the current font object.
Returns the current font object.
-----------------------------------------------------------
:GETFONTCOMPOUNDNAME()
Get the current font compound name.
Returns the current font compound name.
-----------------------------------------------------------
:BOX ( <þnSrowþ>, <þnScolþ>, <þnErowþ>, <þnEcolþ>, ;
[<þnFillþ>], [<þnHradþ>], [<þnVradþ>], [<þaAttrþ>] )
Prints on Box on the page.
<þnSrowþ>, <þnScolþ>, <þnErowþ>, <þnEcolþ> are the page coordinates to
print the box. These are row/column text coordinates unless
the <þpixelþ> argument was passed to :NEW() as a .TRUE. when the
printer object was created, then they are pixel coordinates.
The optional argument <þnFillþ> specifies whether the rectangle
is drawn as an outline or is filled. The following table shows
the #define constants from the GRA.CH file to use for <þnFillþ> :
Constant Description
GRA_FILL Fills rectangle
GRA_OUTLINE (*) Only draws rectangle border
GRA_OUTLINEFILL Draws rectangle border and fills
(*) Default value
The parameters <þnHRadþ> and <þnVRadþ> determine how much to round
the corners of the rectangle. Both are positive integers
which, taken together, determine the distance (radius of
curvature) from a corner to the middle o fthe rectangle. This
distance provides the measure from which the corners are
rounded. <þnHRadþ> indicates the horizontal distance. When
<þnHRadþ> is equal to <þnVRadþ> , the corners are rounded by
a 90 degree arc.
<þaAttrþ> is an array of attributes that conforms to the specification
for GraBox().
Returns NIL.
-----------------------------------------------------------
:LINE ( <þnSrowþ>, <þnScolþ>, <þnErowþ>, <þnEcolþ>, [<þaAttrþ>] )
Prints on Line on the page.
<þnSrowþ>, <þnScolþ>, <þnErowþ>, <þnEcolþ> are the page coordinates to
print the line. These are row/column text coordinates unless
the <þpixelþ> argument was passed to :NEW() as a .TRUE. when the
printer object was created, then they are pixel coordinates.
<þaAttrþ> is an array of attributes that conforms to the specification
for GraLine().
Returns NIL.
-----------------------------------------------------------
:MARKER ( <þnSrowþ>, <þnScolþ>, [<þaAttrþ>] )
Prints on Marker on the page.
<þnSrowþ>, <þnScolþ> are the page coordinates to print the marker.
These are row/column text coordinates unless the <þpixelþ> argument
was passed to :NEW() as a .TRUE. when the printer object was
created, then they are pixel coordinates.
<þaAttrþ> is an array of attributes that conforms to the specification
for GraMarker().
Returns NIL.
-------------------------------------------------------------
:PENCOORDS( <þnSrowþ>, <þnScolþ> )
Translates text-based page coordinates to actual pen coordinates
for use with the :Eval() method.
Returns an array of two numeric values.
-------------------------------------------------------------
:EVAL( bEval )
Evaluates a code block. This method is used to use Gra*()
functions for creating custom reports, graphs, pie-charts, etc.
The DC_Printer() object is passed to the code block.
Returns SELF
-------------------------------------------------------------
:SCALEFACTOR()
Returns the scaling factor for the UNITS of the presentation
space.
UNITS Scaling Factor
------------------- --------------
GRA_PU_LOMETRIC 1
GRA_PU_HIMETRIC 10
GRA_PU_PIXEL 1.2
GRA_PU_LOENGLISH .3935
GRA_PU_HIENGLISH 3.935
GRA_PU_TWIPS 5.66
Notes:
The DC_PRINTER() methods which create output look at the
current ::nPage instance variable and compares it to the
::nFrom value and the ::nTo value. These are the page
numbers to be printed as selected by the user. If the
current page is outside the range selected by the user,
then no output will be sent to the printer.
Examples:
#include "dcdialog.ch"
procedure Xtest()
LOCAL oPrinter, i
USE collect
BEGIN SEQUENCE
oPrinter := DC_PRINTER():new()
IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
BREAK
ENDIF
FOR i := 1 TO oPrinter:nCopies
oPrinter:nPage := 1
GO TOP
DO WHILE !Eof()
oPrinter:SetFont('16.Arial')
oPrinter:AtSay(1,10,'My Collection')
oPrinter:AtSay(1,30,'Page ' + Alltrim(Str(oPrinter:nPage)))
oPrinter:BitMap( 4,10,50,20, COLLECT->bitmap1 )
oPrinter:SetFont('12.Courier New')
oPrinter:AtSay(24,10,' Description:')
oPrinter:AtSay(25,10,' Type:')
oPrinter:AtSay(26,10,' Sub-Type:')
oPrinter:SetFont('14.Terminal')
oPrinter:AtSay(24,32,COLLECT->descrip)
oPrinter:AtSay(25,32,COLLECT->type)
oPrinter:AtSay(26,32,COLLECT->sub_type)
oPrinter:Eject()
SKIP
ENDDO
NEXT
oPrinter:Destroy()
END SEQUENCE
RETURN
Source/Library:
_DCPRC.PRG/.OBJ, DCLIPX.LIB
See Also:
DCPRINT ON
dc_printerobject()
dc_html()
A base class for creating any HTML element
Syntax:
DC_Html():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Returns:
Self
Description:
DC_Html() is a class for creating HTML elements from
a set of properties. The :writeHtml() method returns the
source code of the element tag and all of its child
elements.
DC_Html() is the base class for all DC_Html*() classes.
All other DC_Html*() classes inherit from DC_Html().
Exported Instance Variables:
Name Type Description
--------------- ------- --------------------------------
htmlText C/B HTML text to write
bgcolor C/B Background color #XXXXXX
style C/B Font or Style
startrow N Start Row of parent table
startcol N Start Column of parent table
childList A Array containing child objects
parent O Parent object
cargo X User Cargo
getList A The Getlist array
getListPointer N Item number in Getlist
varName C Name of variable
dataLink B Get-Set codeblock
border N/B Border
preHtmlText C/B HTML text to write before tag
postHtmlText C/B HTML text to write after tag
options A Options array
hideBlock B Code block to evaluate to hide output
whenBlock B Code block to evaluate for special conditions
toolTip C/B Tooltip to display on mouseover
message C/B Message to display on mouseclick
colSpan N Number of cols to span in parent table
rowSpan N Number of rows to span in parent table
noWrap L Do not wrap text
align N/B Horizontal Alignment
valign N/B Vertical Alignment
height N Height
width N Width
heading C/B Heading
footing C/B Footing
borderColor X Border Color
borderColorLight X Border Color Light
borderColorDark X Border Color Dark
<þhtmlTextþ> is any text containing HTML elements or just
plain text.
<þbgColorþ> specifies the background color for the text.
Value may be an RGB color value (#XXXXXX), a standard color
name, an RGB 3-element array or a numeric value defined in
GRA.CH.
<þstyleþ> is the style tag to wrap around the text. For
example "H3" will create the following source:
<þH3þ><þhtmlTextþ><þ/H3þ>.
<þstartRowþ> and <þstartColþ> are the row number and column
number of the table if the parent of this object is a
DC_HtmlTable(). The text will be inserted in the cell of
the table defined by the row/column.
<þchildListþ> is an array of child objects.
<þparentþ> is a pointer to the parent of this object.
<þcargoþ> is reserved for user cargo.
<þgetListþ> is the GetList array that was used to define
this object.
<þgetListPointerþ> is the element of the GetList array that
was used to define this object.
<þvarNameþ> is any variable name associated with this object.
<þdataLinkþ> is any Get-Set codeblock associated with this
object.
<þborderþ> is the border in pixels around the HTML element
created by this object.
<þpreHtmlTextþ> is a character string or a code block
that returns a character string containing any HTML text
that will precede the source that is written.
<þpostHtmlTextþ> is a character string or a code block
that returns a character string containing any HTML text
that will follow the source that is written.
<þoptionsþ> is a pointer to a DC_HtmlOptions() object that
defines general options for all objects created from the
GetList.
<þhideBlockþ> is a code block to evaluate which will
suppress any creation of code by the :writeHtml() method
of this object if it returns a .TRUE. value.
<þwhenBlockþ> is used only by some sub-classes. This is
a code block that changes the behavior of the element
depending on if it returns a TRUE or a FALSE. For example
this code block is used by DC_HtmlImage() to choose between
one of two image URLs.
<þtoolTipþ> a character string containing the tooltip to
display when the mouse is passed over the element in the
browser.
<þmessageþ> is a character string containing a message to
assign to the <þoptions:messageþ> variable when the mouse
is clicked on the element in the browser. This creates
an <þa hrefþ> around the element and sends a URL equivalent
to /?<þoptions:messageintoþ>=<þmessageþ>.
<þcolSpanþ> is the number of columns to span in the parent
table if the parent of this object is a DC_HtmlTable().
For example, a value of 3 tells the browser to make the
cell occupy the same horizontal space as three cells in
rows above or below it. the browser flows the contents
of the cell to occupy the entire space.
<þrowSpanþ> is the number of rows to span in the parent
table if the parent of this object is a DC_HtmlTable().
For example, a value of 3 tells the browser to create a
cell that occupies the current row plus two more rows
below that.
<þnoWrapþ> is used to suppress wrapping of text within the
cell if the parent of this object is a DC_HtmlTable().
<þalignþ> is used to align the text horizontally within a
table cell if the parent of this object is a DC_HtmlTable().
Acceptable values are "left", "right" and "center".
<þvAlignþ> is used to align the text vertically within a
table cell if the parent of this object is a DC_HtmlTable().
Acceptable values are "top", "bottom" and "center".
<þheightþ> and <þwidthþ> are used only by some sub-classes.
For example, a DC_HtmlMle() object requires a height and
width.
<þheadingþ> and <þfootingþ> are not yet defined.
<þborderColorþ>, <þborderColorLightþ> and <þborderColorDarkþ>
are used to define the border around the cell if the
parent of this object is a DC_HtmlTable().
Internet explorer lets you alter the colors that make up an
individual cell's border - if border are turned on with the
border attribute. The values for <þborderColorþ>,
<þborderColorDarkþ> and <þborderColorLightþ> may be
an RGB color value (#XXXXXX) , a standard color name, an
RGB 3-element array or a numeric value defined in GRA.CH.
The different colors shade the edges of the border to give
it a 3D appearance with <þborderColorþ> shades the central
body of the border.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Parent object may be from any DC_Html*() class.
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Main()
LOCAL i, GetList[0], oTable, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock
DCTABLE OBJECT oTable ROWS 5 COLS 4
@ 2,3 DCHTML TEXT 'This is some text' PARENT oTable
@ 4,4 DCHTML TEXT 'This is some more text' PARENT oTable
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := aGetListItem[bGETLIST_PARENT]) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTML
oHtml := DC_Html():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := aGetListItem[bGETLIST_GROUP]) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
DCHTML
dc_htmlbody()
A class for creating an HTML body tag
Syntax:
DC_HtmlBody():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlBody() is a class for creating the <þBODYþ> tag of an
html document.
The :writeHtml() method returns the source code of the
IMG tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
link C Color of unused links
alink C Color when clicking a link
vlink C Color of previously visited links
topMargin N Top margin of document
leftMargin N Bottom margin of document
background C URL of background image
bgProperties C Properties of background
onLoad C Procedure to run
textColor C Color of text in body
<þlinkþ> is the color of hyperlinks which have never been
visited. Value may be an RGB color value (#XXXXXX),
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
<þalinkþ> is the color of hyperlinks which has been clicked.
Value may be an RGB color value (#XXXXXX), a standard
color name, an RGB 3-element array or a numeric value
defined in GRA.CH.
<þvlinkþ> is the color of hyperlinks which have been previously
visited. Value may be an RGB color value (#XXXXXX),
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
<þtextColorþ> is the color of the text in the body of the document.
Value may be an RGB color value (#XXXXXX), a standard
color name, an RGB 3-element array or a numeric value defined
in GRA.CH.
<þtopMarginþ> and <þleftMarginþ> are the margins in pixels of
the body of the document.
<þbackgroundþ> is a URL pointing to a .JPG or .GIF image to
be used as the background for the body of text.
<þbgPropertiesþ> if empty allows the background to scroll.
A value of "fixed" will prevent the background from scrolling.
<þonLoadþ> is a Script command that will execute after the
document is loaded.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oMain, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass, oBody
DCHTMLMAIN OBJECT oMain
DCHTMLBODY OBJECT oBody ;
BACKGROUND "http://donnay-software.com/graphics/expback1.gif" ;
STYLE "\exp18\html\default.css" ;
PARENT oMain
DCHTML TEXT MemoRead('\exp18\readme.txt') ;
STYLE 'PRE' ;
PARENT oBody
aClass := { { GETLIST_HTMLMAIN, {|o,a|DC_HtmlMain():new(o,a)} }, ;
{ GETLIST_HTMLBODY, {|o,a|DC_HtmlBody():new(o,a)} }, ;
{ GETLIST_HTML , {|o,a|DC_Html():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
DCHTMLBODY
dc_htmlbrowse()
A class for creating a BROWSE in HTML
Syntax:
DC_HtmlBrowse():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlBrowse() is a class for creating HTML tables. The
:writeHtml() method returns the source code of the table
tag and all of its child elements. Child objects must
be of the DC_HtmlColumn() class (1 for each column).
Exported Instance Variables:
The following instance variables are in addition to those
of the parent classes - DC_Html() and DC_HtmlTable().
Name Type Description
-------------- -------- --------------------------------
dataSource C/A Database alias or Array
pointer N Current record or array pointer
headerDelim C Header delimiter
footerDelim C Footer delimiter
<þdataSourceþ> is the alias of the database when browsing an
database or a multi-dimensional array.
<þpointerþ> is the current record pointer or array pointer.
<þheaderDelimþ> is the delimiter character to use in header
strings assigned by the DC_HtmlColumn() object. Header
lines will be broken on each delimeter character into
separate rows.
<þfooterDelimþ> is the delimiter character to use in header
strings assigned by the DC_HtmlColumn() object. Footer
lines will be broken on each delimeter character into
separate rows.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html() and DC_HtmlTable().
Parent object may be from any DC_Html*() class.
Child objects must be from DC_HtmlColumn() class.
Examples:
/*
This is an example of an array browse
*/
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oTable, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, aDir := Directory()
@ 0,0 DCBROWSE oBrowse SIZE 4,10 DATA aDir
DCBROWSECOL ELEMENT 1 HEADER 'File Name' PARENT oBrowse
DCBROWSECOL ELEMENT 2 HEADER 'File Size' PARENT oBrowse
DCBROWSECOL ELEMENT 3 HEADER 'File Date' PARENT oBrowse
DCBROWSECOL ELEMENT 4 HEADER 'File Time' PARENT oBrowse
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_BROWSE
oHtml := DC_HtmlBrowse():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_BROWSECOL
oHtml := DC_HtmlColumn():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCBROWSE
dc_htmlcolumn()
dc_htmlcheckbox()
A class for creating a CHECKBOX in HTML
Syntax:
DC_HtmlCheckBox():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlCheckBox() is a class for creating HTML checkbox
input elements. The :writeHtml() method returns the source
code of the INPUT tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
NONE
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, lCheck1, lCheck2, lCheck3
DCFORM OBJECT oForm
DCTABLE OBJECT oTable PARENT oForm ROWS 3 COLUMNS 1
lCheck1 := .t.
lCheck2 := .f.
lCheck3 := .f.
@ 1,1 DCCHECKBOX lCheck1 PROMPT 'Check me first' PARENT oTable
@ 2,1 DCCHECKBOX lCheck2 PROMPT 'Check me second' PARENT oTable
@ 3,1 DCCHECKBOX lCheck3 PROMPT 'Check me third' PARENT oTable
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_CHECKBOX
oHtml := DC_HtmlCheckBox():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCCHECKBOX
dc_htmlcolumn()
A class for creating a BROWSE COLUMN in HTML
Syntax:
DC_HtmlColumn():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_HtmlBrowse() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlColumn() is a class for creating HTML table columns.
The :writeHtml() method returns the source code of the column
tags and all of its child elements.
The parent of DC_HtmlColumn() objects must be of the
DC_HtmlBrowse() class.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
element N Array element (when browsing array)
headerArray A Header array
headerBlock B Header code block
headerColor C Header color
headerStyle C Header style
footerArray A Footer array
footerBlock B Footer code block
footerColor C Footer color
footerStyle C Footer style
<þelementþ> is the element number of the array being browsed.
<þheaderArrayþ> is an array containing each row of the header.
This is created by parsing out the character string returned
by evaluating the <þheaderBlockþ>. The delimiter character
is the parent:headerDelim.
<þfooterArrayþ> is an array containing each row of the footer.
This is created by parsing out the character string returned
by evaluating the <þfooterBlockþ>. The delimiter character
is the parent:footerDelim.
<þheaderColorþ> specifies the default background color for
the header. Value may be an RGB color value (#XXXXXX),
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
<þfooterColorþ> specifies the default background color for
the footer. Value may be an RGB color value (#XXXXXX),
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
<þheaderStyleþ> is the style tag to wrap around the header
text. For example "H3" will create the following source:
<þH3þ><þheaderþ><þ/H3þ>.
<þfooterStyleþ> is the style tag to wrap around the footer
text. For example "H3" will create the following source:
<þH3þ><þfooterþ><þ/H3þ>.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_HtmlBrowse() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object must be from any DC_HtmlBrowse() class.
Examples:
/*
This is an example of an array browse
*/
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oTable, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, aDir := Directory()
@ 0,0 DCBROWSE oBrowse SIZE 4,10 DATA aDir
DCBROWSECOL ELEMENT 1 HEADER 'File Name' PARENT oBrowse
DCBROWSECOL ELEMENT 2 HEADER 'File Size' PARENT oBrowse
DCBROWSECOL ELEMENT 3 HEADER 'File Date' PARENT oBrowse
DCBROWSECOL ELEMENT 4 HEADER 'File Time' PARENT oBrowse
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_BROWSE
oHtml := DC_HtmlBrowse():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_BROWSECOL
oHtml := DC_HtmlColumn():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
DCBROWSECOL
dc_htmlbrowse()
dc_htmlcombobox()
A class for creating a COMBO BOX in HTML
Syntax:
DC_HtmlComboBox():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlComboBox() is a class for creating HTML select
input elements. The :writeHtml() method returns the source
code of the SELECT and OPTIONS tags.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
listArray A Array containing list items
<þlistArrayþ> is an array of character strings. The items
in this array will be included in the pulldown box.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, aList1, aList2, cVar1, cVar2
DCFORM OBJECT oForm
DCTABLE OBJECT oTable PARENT oForm ROWS 2 COLUMNS 1
cVar1 := Space(10)
cVar2 := Space(12)
aList1 := { 'Men','Women','Dogs','Cats','Mice','Geese','Turkeys' }
aList2 := { 'Democrat','Republican','HandyMan','Doctor','Plumber','Programmer'
}
@ 1,1 DCSAY 'Pick a group' PARENT oTable
@ 1,1 DCCOMBOBOX cVar1 LIST aList1 PARENT oTable
@ 2,1 DCSAY 'Pick a profession' PARENT oTable
@ 2,1 DCCOMBOBOX cVar2 LIST aList2 PARENT oTable
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_SAY
oHtml := DC_HtmlSay():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_COMBOBOX
oHtml := DC_HtmlComboBox():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCCOMBOBOX
dc_htmlform()
A class for creating FORM tags in HTML
Syntax:
DC_HtmlForm():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlForm() is a class for creating HTML form elements.
The :writeHtml() method returns the source code of the
FORM tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
encType C Encode type
action C Form action URL
formMethod C Form method (POST or GET)
target C Target window or frame
<þencTypeþ> is the encoding type of the data submitted.
The default is "application/x-www-form-urlencoded". An
alternate type is "multipart/form-data".
<þactionþ> is the URL of the application that receives and
process the form data.
<þformMethodþ> is the method for sending the data to the
application server. The valid options are "GET" and "POST".
For small forms with few variables use "GET". For large
forms with many variables use "POST".
<þtargetþ> is the name of the window or frame which will
receive the posted data.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, cComment1, cComment2
DCFORM OBJECT oForm METHOD "POST" ;
ACTION "http://donnay-software.com:8083"
DCTABLE OBJECT oTable PARENT oForm ROWS 2 COLUMNS 1 WIDTH '200'
cComment1 := 'This is memo 1'
cComment2 := 'This is memo 2'
@ 1,1 DCMULTILINE cComment1 PARENT oTable SIZE 30,10 NAME 'Memo1'
@ 2,1 DCMULTILINE cComment2 PARENT oTable SIZE 30,10 NAME 'Memo2'
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_MLE
oHtml := DC_HtmlMle():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
dc_htmlframe()
A class for creating FRAME tags in HTML
Syntax:
DC_HtmlFrame():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlFrame() is a class for creating HTML frame elements.
The :writeHtml() method returns the source code of the
FRAMESET tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
sourceUrl C URL of document to put in frame
frameName C Name of frame
marginHeight N Margin Height
marginWidth N Margin Width
noResize L No resize of frame
scrolling L Allow scrolling
frameBorder N Frame border
<þsourceURLþ> is the URL of the document that is to be
displayed in the frame. There is no other way to provide
content for a frame.
<þframeNameþ> labels the frame for later reference by the
"target" attribute of other HTML elements.
<þmarginHeightþ> and <þmarginWidthþ> are used to put space
(in pixels) between the edge of the frame and its contents.
<þnoResizeþ> freezes the relative proportions of the frame
so it may not be resized.
<þscrollingþ> displays vertical and horizontal scrollbars
with frames whose contents exceed the allotted window
space.
<þframeBorderþ> is used to determine whether or not there
is a frame border. A value of 1 turns on the border. A
value of 0 turns off the border.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent objects must be from the DC_HtmlFrameSet() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oFrameSet, aClass
DCFRAMESET OBJECT oFrameSet ;
ROWS '60%,*'
DCFRAME ;
PARENT oFrameSet ;
NAME 'donnay' ;
SRC 'http://donnay-software.com'
DCFRAME ;
PARENT oFrameSet ;
FRAMEBORDER 0 ;
NAME 'google' ;
SRC 'http://www.google.com'
aClass := { { GETLIST_HTMLFRAMESET, {|o,a|DC_HtmlFrameSet():new(o,a)} }, ;
{ GETLIST_HTMLFRAME , {|o,a|DC_HtmlFrame():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
DCFRAME
dc_htmlframeset()
A class for creating FRAMESET tags in HTML
Syntax:
DC_HtmlFrameSet():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlFrameSet() is a class for creating HTML frameset
elements.
The :writeHtml() method returns the source code of the
FRAMESET tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
columns C Number of frames in columns
rows C Number of frames in rows
frameBorder N Frame Border
<þcolumnsþ> and <þrowsþ> defines the number of columns and rows
of either frames or nested framesets. Both attributes
accept a quote-enclosed, comman-separated list of values
that specify either the absolute or relative width (for
columns) or height (for rows) for the frames. The number
of attribute valuess determines how many rows or columns of
frames will display in the document window.
Express each value in the <þrowsþ> or <þcolumnsþ> attribute
in one of three ways:
1. As absolute number of pixels.
2. As a percentage of the total width or height of the
frameset.
3. As a portion of the space remaining after setting aside
room for adacent elements.
Examples:<þrowsþ> = "150,300,150"
<þrowsþ> = "25%,50%,25%"
<þcolumnsþ> = "100,*"
<þcolumnsþ> = "10,*,10"
<þrowsþ> = "*,100,*"
<þframeBorderþ> is used to determine whether or not there
is a frame border. A value of 1 turns on the border. A
value of 0 turns off the border.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Child objects must be from the DC_HtmlFrame() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oFrameSet, aClass
DCFRAMESET OBJECT oFrameSet ;
ROWS '60%,*'
DCFRAME ;
PARENT oFrameSet ;
NAME 'donnay' ;
SRC 'http://donnay-software.com'
DCFRAME ;
PARENT oFrameSet ;
FRAMEBORDER 0 ;
NAME 'google' ;
SRC 'http://www.google.com'
aClass := { { GETLIST_HTMLFRAMESET, {|o,a|DC_HtmlFrameSet():new(o,a)} }, ;
{ GETLIST_HTMLFRAME , {|o,a|DC_HtmlFrame():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
DCFRAMESET
dc_htmlget()
A class for creating a GET in HTML
Syntax:
DC_HtmlGet():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlGet() is a class for creating HTML text type
input elements. The :writeHtml() method returns the source
code of the INPUT tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
password L Get is a password
<þpasswordþ> if .TRUE. will protect the visibility of the
Get so the data entered is shown only as asterisks.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, cUserId, cPassword
DCFORM OBJECT oForm
DCTABLE OBJECT oTable PARENT oForm ROWS 2 COLUMNS 2 WIDTH '200'
cUserId := Space(10)
cPassword := Space(10)
@ 1,1 DCSAY 'User ID' PARENT oTable
@ 1,2 DCGET cUserId PARENT oTable NAME 'App.User'
@ 2,1 DCSAY 'Password' PARENT oTable
@ 2,2 DCGET cUserId PARENT oTable NAME 'App.Password' PASSWORD
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_SAY
oHtml := DC_HtmlSay():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_GET
oHtml := DC_HtmlGet():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCGET
dc_htmlhyperlink()
A class for creating HYPERLINK tags in HTML
Syntax:
DC_HtmlHyperLink():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlHyperlink() is a class for creating HTML href elements
for hyperlinks. The :writeHtml() method returns the source
code of the <þAþ> tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
href C URL to navigate to
methods C Method of the href
name C Name of label
rel C Relation from source to target
rev C Relation from target to source
title C Title to display in tooltip
target C Target window or frame
urn C Universal Resource Name
<þhrefþ> is the URL to navigate to when the user clicks on
the text or image underlined.
<þmethodsþ> is the method of the href.
<þnameþ> is the name of the label within the target document.
<þrelþ> is the relationship of the source to the target.
<þrevþ> is the relationship of the target to the source.
<þtitleþ> is a tooltip to display when the mouse is moved
over the hyperlink.
<þtargetþ> is the name of the window or frame which is the
target for the returned response.
<þurnþ> is the Uniform Resource Name for a referenced document.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oLink, aClass
DCHYPERLINK HREF "http://donnay-software.com" ;
OBJECT oLink
DCIMAGE SRC "http://donnay-software.com/graphics/donnay-logo.jpg" ;
ALT 'Donnay Logo' PARENT oTable ;
HEIGHT 100 ;
PARENT oLink
aClass := { { GETLIST_HTMLLINK , {|o,a|DC_HtmlHyperLink():new(o,a)} }, ;
{ GETLIST_HTMLIMAGE, {|o,a|DC_HtmlImage():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
dc_htmlimage()
A class for creating IMAGE tags in HTML
Syntax:
DC_HtmlImage():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlImage() is a class for creating HTML image elements.
The :writeHtml() method returns the source code of the
IMG tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
src C URL source of the image
dynsrc C URL source of AVI clip
lowsrc C URL source of low res image
alt C Alternate Text
usemap C Client-side image map
_loop L Loop playing of AVI clip
align C Image alignment
start C Options for starting AVI clip
vspace N Vertical space
hspace N Horizontal space
controls C URL for controls of AVI player
border N Border around image
ismap L Send map coordinates
<þsrcþ> is the URL source of the image to display.
<þdynsrcþ> (Internet Explorer) is the URL source of an AVI
clip to play.
<þlowsrcþ> is the URL source of the low resolution image to
display while the browser is loading the high resolution
image (for speed in loading).
<þaltþ> is the text to display in the event that the URL for
the image is broken.
<þusemapþ> is the name of a map that is created with the <þMAPþ>
tag of HTML.
<þ_loopþ> (Internet Explorer) if .TRUE. will force continuous
playing of the AVI clip.
<þalignþ> is used to align the image within the body content.
Acceptable values are "top", "middle", "bottom", "texttop",
"absmiddle","baseline" and "absbottom".
<þstartþ> (Internet Explorer) contains options for how to
start the AVI clip.
<þvSpaceþ> is the amount of vertical space.
<þhSpaceþ> is the amount of horizontal space.
<þcontrolsþ> (Internet Explorer) is a URL pointing to an
image used as the controls for the AVI player.
<þborderþ> should be set to 0 to eliminate the hyperlink
attribute around the image.
<þismapþ> if .TRUE. will send the coordinates of the mouse
when clicked on the image.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass
DCTABLE OBJECT oTable ;
ROWS 1 COLUMNS 2 BORDER 1
@ 1,1 DCIMAGE SRC "http://donnay-software.com\graphics\donnay-logo.jpg" ;
ALT 'Donnay Logo' PARENT oTable ;
HEIGHT 100
@ 1,2 DCIMAGE SRC "http://donnay-software.com\graphics\xb2net.gif" ;
ALT 'XB2.NET Logo' PARENT oTable ;
VSPACE 20 ;
HSPACE 20
aClass := { { GETLIST_HTMLTABLE , {|o,a|DC_HtmlTable():new(o,a)} }, ;
{ GETLIST_HTMLIMAGE , {|o,a|DC_HtmlImage():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
DCIMAGE
dc_htmlinput()
A class for creating an HTML input tag
Syntax:
DC_HtmlInput():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlInput() is a class for creating different types
of input elements to be used within a form.
The :writeHtml() method returns the source code of the
IMG tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
type N/C Type of element
checked L Item is checked (or default)
maxLength N Maximum length
size N Size
value X Value of item
src C URL for image
caption C Caption of item
listArray A Array of list items
onFocus C Script to run when item receives focus
onBlur C Script to run when item loses focus
onSelect C Script to run when item selected
onChange C Script to run when item changed
onClick C Script to run when item clicked
tabIndex C/N Order in tab list
accessKey C Hotkey to access item
accept C Content type
<þtypeþ> is the type of input element to create:
Type Description
------------------------------ ------------------------------
DCHTML_INPUT_TEXT Text similar to standard GET
or "text"
DCHTML_INPUT_PASSWORD Text similar to standard GET
or "password" except asterisks mask input
DCHTML_INPUT_CHECKBOX Logical checkbox
or 'checkbox'
DCHTML_INPUT_RADIOBUTTON Radio button
or 'radio'
DCHTML_INPUT_SUBMITBUTTON Pushbutton to submit form
or 'submit'
DCHTML_INPUT_RESETBUTTON Pushbutton to reset form
or 'reset'
DCHTML_INPUT_IMAGE Clickable image (returns coords)
or 'image'
DCHTML_INPUT_HIDDEN Hidden variable
or 'hidden'
DCHTML_INPUT_TEXTAREA Memo text similar to MLE
or 'textarea'
DCHTML_INPUT_SELECT Combo box
or 'select'
DCHTML_INPUT_BUTTON Push button
or 'button'
DCHTML_INPUT_FILE File Choose Dialog
or 'file'
If <þcheckedþ> is .TRUE. then the input item will be checked.
This applies only to "radio" and "checkbox" items.
<þmaxLengthþ> is the maximum amount of text allowed to be
input. Applies to type "text", "password" and "textarea".
<þsizeþ> is the length (in characters) of type "text" or
"password" items.
<þvalueþ> is the current value of the item.
<þsrcþ> is the URL of the image if the type of input is an
"image".
<þcaptionþ> is the text of the caption associated with the
item. This applies only to type "submit", "reset" or
"button".
<þlistArrayþ> is an array of list items for inputs of type
"select".
<þonFocusþ> is a script to run when the item receives
focus.
<þonBlurþ> is a script to run when the item loses focus.
<þonSelectþ> is a script to run when an item has been
selected.
<þonChangeþ> is a script to run when an item has changed.
<þonClickþ> is a script to run when an item has been clicked
with the mouse.
<þtabIndexþ> is the order in the tab list for this item.
<þaccessKeyþ> assigns an access key to the item. An access
key is a single character from the document character set.
<þacceptþ> is the Content Type.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, oTable, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass, aListItems, cUserId, cPassword, ;
lCheck, oForm
cUserId := Space(10)
cPassword := ''
lCheck := .t.
aListItems := { 'Men','Women','Dogs','Cats','Mice','Turkeys' }
DCFORM OBJECT oForm
DCTABLE OBJECT oTable ROWS 10 COLUMNS 2 BORDER 1 PARENT oForm
@ 1,1 DCSAY 'User ID' PARENT oTable
@ 1,2 DCINPUT VALUE cUserId NAME 'Input.Type.Text' ;
PARENT oTable MAXLENGTH 10
@ 2,1 DCSAY 'Password' PARENT oTable
@ 2,2 DCINPUT TYPE "password" VALUE cPassword ;
NAME 'Input.Type.PassWord' PARENT oTable MAXLENGTH 10
@ 3,1 DCSAY 'CheckBox' PARENT oTable
@ 3,2 DCINPUT TYPE "checkbox" NAME 'Input.Type.CheckBox' ;
VALUE lCheck CHECKED PARENT oTable
@ 4,1 DCSAY 'Radio Buttons' PARENT oTable
@ 4,2 DCINPUT TYPE "radio" VALUE 'M' NAME 'Input.Type.RadioButton' ;
PARENT oTable POST 'Mint
'
@ 4,2 DCINPUT TYPE "radio" VALUE 'E' NAME 'Input.Type.RadioButton' ;
PARENT oTable POST 'Excellent
'
@ 4,2 DCINPUT TYPE "radio" VALUE 'G' NAME 'Input.Type.RadioButton' ;
CHECKED PARENT oTable POST 'Good
'
@ 4,2 DCINPUT TYPE "radio" VALUE 'F' NAME 'Input.Type.RadioButton' ;
PARENT oTable POST 'Fair
'
@ 4,2 DCINPUT TYPE "radio" VALUE 'P' NAME 'Input.Type.RadioButton' ;
PARENT oTable POST 'Poor
'
@ 5,1 DCSAY 'Submit Button' PARENT oTable
@ 5,2 DCINPUT TYPE "submit" VALUE 'Hit Me!' ;
NAME 'Input.Type.Submit' PARENT oTable
@ 6,1 DCSAY 'Reset Button' PARENT oTable
@ 6,2 DCINPUT TYPE "reset" VALUE 'Reset Form!' ;
NAME 'Input.Type.Reset' PARENT oTable
@ 7,1 DCSAY 'Image' PARENT oTable
@ 7,2 DCINPUT TYPE "image" SRC '\exp18\images\express2.gif' ;
NAME 'Input.Type.Image' PARENT oTable
@ 8,1 DCSAY 'ComboBox' PARENT oTable
@ 8,2 DCINPUT TYPE "select" ;
LIST aListItems ;
NAME 'Input.Type.Select' PARENT oTable
@ 9,1 DCSAY 'File' PARENT oTable
@ 9,2 DCINPUT TYPE "file" ;
SIZE 40 ;
MAXLENGTH 100 ;
NAME 'Input.Type.File' PARENT oTable
@10,1 DCSAY 'Read Me' PARENT oTable
@10,2 DCINPUT ;
TYPE DCHTML_INPUT_TEXTAREA ;
WIDTH 60 HEIGHT 20 ;
NAME 'Input.Type.TextArea' ;
VALUE {||MemoRead('\exp18\samples\html\readme.txt')} ;
PARENT oTable
aClass := { { GETLIST_HTMLINPUT, {|o,a|DC_HtmlInput():new(o,a)} }, ;
{ GETLIST_HTMLTABLE, {|o,a|DC_HtmlTable():new(o,a)} }, ;
{ GETLIST_HTMLFORM, {|o,a|DC_HtmlForm():new(o,a)} }, ;
{ GETLIST_SAY , {|o,a|DC_HtmlSay():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_htmllist()
A class for creating a LIST in HTML
Syntax:
DC_HtmlList():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlList() is a class for creating HTML list elements.
The :writeHtml() method returns the source code of the
UL, OL, DIR, MENU, DL and LI tags.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
type C Type of list
listItems A Items in list
listType C Subtype of list
compact L List is compact
<þtypeþ> is the type of the list:
"ul" or DCHTML_LIST_UNORDERED creates an unordered list.
"ol" or DCHTML_LIST_ORDERED creates an ordered list.
"dir" or DCHTML_LIST_DIRECTORY creates a directory list.
"menu" or DCHTML_LIST_MENU creates a menu list.
"dl" or DCHTML_LIST_DEFINITION creates a definition list.
<þlistItemsþ> is an array of items to be displayed in the
list. If no array of items is used then the list of items
consists of child objects of the type DC_HtmlListItem().
<þlistTypeþ> is the type of each list item. This has a
different meaning for different types of lists.
Ordered lists:
"A" will order each item in capital letters.
"a" will order each item in lower case letters.
"I" wlll order each item in capital Roman numerals.
"i" wlll order each item in lower case Roman numerals.
"1" will order each item in Arabic numerals.
Unordered, Directory, and Menu lists:
"disc" will display a disc image in front of the item
"circle" will display a circle image in front of the item
"square" will display a square image in front of the item
<þcompactþ> will tell the browser to reduce the indentation
and number of spaces between the sequence numbers and the
list items, or both.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Child objects must be of the DC_HtmlListItem() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, oTable, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass, oList1, oList2, aListItems
aListItems := { 'Men','Women','Dogs','Cats','Mice','Turkeys' }
DCTABLE OBJECT oTable ROWS 1 COLUMNS 2
@ 1, 1 DCLIST OBJECT oList1 ;
TYPE 'ol' ;
ITEMLIST aListItems ;
ITEMTYPE 'i' ;
PARENT oTable
@ 1, 2 DCLIST OBJECT oList2 ;
TYPE 'ul' ;
PARENT oTable
FOR i := 1 TO Len(aListItems)
DCLISTITEM aListItems[i] ;
PARENT oList2 ;
TYPE 'circle'
NEXT
aClass := { { GETLIST_HTMLLIST , {|o,a|DC_HtmlList():new(o,a)} }, ;
{ GETLIST_HTMLLISTITEM, {|o,a|DC_HtmlListItem():new(o,a)} }, ;
{ GETLIST_HTMLTABLE , {|o,a|DC_HtmlTable():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
dc_htmllistitem()
A class for creating LIST ITEMS in HTML
Syntax:
DC_HtmlListItem():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlListItem() is a class for creating HTML list
item elements.
The :writeHtml() method returns the source code of the
LI tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
type C Type of list item
value C Change ordered value
caption C Text of list item
<þtypeþ> is the type of the list item. This has a
different meaning for different types of lists as set by
the parent DC_HtmlList() object.
Ordered lists:
"A" will order each item in capital letters.
"a" will order each item in lower case letters.
"I" wlll order each item in capital Roman numerals.
"i" wlll order each item in lower case Roman numerals.
"1" will order each item in Arabic numerals.
Unordered, Directory, and Menu lists:
"disc" will display a disc image in front of the item
"circle" will display a circle image in front of the item
"square" will display a square image in front of the item
<þvalueþ> lets you change the number of a specific list
item and those that follow it. This is valid only for
ordered lists. Example <þvalueþ> = 9 will change the order
numbering to start at 9.
<þcaptionþ> is the text of the list item.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object must be of the DC_HtmlList() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, oTable, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass, oList1, oList2, aListItems
aListItems := { 'Men','Women','Dogs','Cats','Mice','Turkeys' }
DCTABLE OBJECT oTable ROWS 1 COLUMNS 2
@ 1, 1 DCLIST OBJECT oList1 ;
TYPE 'ol' ;
ITEMLIST aListItems ;
ITEMTYPE 'i' ;
PARENT oTable
@ 1, 2 DCLIST OBJECT oList2 ;
TYPE 'ul' ;
PARENT oTable
FOR i := 1 TO Len(aListItems)
DCLISTITEM aListItems[i] ;
PARENT oList2 ;
TYPE 'circle'
NEXT
aClass := { { GETLIST_HTMLLIST , {|o,a|DC_HtmlList():new(o,a)} }, ;
{ GETLIST_HTMLLISTITEM, {|o,a|DC_HtmlListItem():new(o,a)} }, ;
{ GETLIST_HTMLTABLE , {|o,a|DC_HtmlTable():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
dc_htmlmain()
A class for creating the main HTML document
Syntax:
DC_HtmlMain():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlMain() is a class for creating the beginning tags in
an HTML document.
The :writeHtml() method returns the source code of the
IMG tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
NONE
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oMain, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass, oBody
DCHTMLMAIN OBJECT oMain
DCHTMLBODY OBJECT oBody ;
BACKGROUND "http://donnay-software.com/graphics/expback1.gif" ;
STYLE "\exp18\html\default.css" ;
PARENT oMain
DCHTML TEXT MemoRead('\exp18\readme.txt') ;
STYLE 'PRE' ;
PARENT oBody
aClass := { { GETLIST_HTMLMAIN, {|o,a|DC_HtmlMain():new(o,a)} }, ;
{ GETLIST_HTMLBODY, {|o,a|DC_HtmlBody():new(o,a)} }, ;
{ GETLIST_HTML , {|o,a|DC_Html():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
DCHTMLMAIN
dc_htmlmle()
A class for creating a MEMO window in HTML
Syntax:
DC_HtmlMle():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlMle() is a class for creating HTML textarea
elements. The :writeHtml() method returns the source code
of the TEXTAREA tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
NONE
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, cComment1, cComment2
DCFORM OBJECT oForm
DCTABLE OBJECT oTable PARENT oForm ROWS 2 COLUMNS 1 WIDTH '200'
cComment1 := 'This is memo 1'
cComment2 := 'This is memo 2'
@ 1,1 DCMULTILINE cComment1 PARENT oTable SIZE 30,10 NAME 'Memo1'
@ 2,1 DCMULTILINE cComment2 PARENT oTable SIZE 30,10 NAME 'Memo2'
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_MLE
oHtml := DC_HtmlMle():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCMULTILINE
dc_htmlradiobutton()
A class for creating a RADIO BUTTON in HTML
Syntax:
DC_HtmlRadioButton():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlRadioButton() is a class for creating HTML radio button
input elements. The :writeHtml() method returns the source code
of the INPUT tag.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
dataValue X Value of data variable
<þdataValueþ> is the value to assign the radio button element
when the user clicks on it in the web browser.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, cProfession := 'Doctor'
aProfession := { 'Democrat','Republican','HandyMan','Doctor', ;
'Plumber','Programmer' }
DCFORM OBJECT oForm
DCTABLE OBJECT oTable PARENT oForm ROWS Len(aProfession) COLUMNS 1
FOR i := 1 TO Len(aProfession)
@ i,1 DCRADIOBUTTON cProfession VALUE aProfession[i] ;
PROMPT aProfession[i] PARENT oTable
NEXT
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_RADIOBUTTON
oHtml := DC_HtmlRadioButton():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCRADIOBUTTON
dc_htmlsay()
A class for creating a SAY in HTML
Syntax:
DC_HtmlSay():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlSay() is a class for creating HTML text. The
:writeHtml() method returns the source code.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
-------------- -------- --------------------------------
NONE
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTable, cProfession := 'Doctor'
aProfession := {
'Democrat','Republican','HandyMan','Doctor','Plumber','Programmer' }
DCFORM OBJECT oForm
DCTABLE OBJECT oTable PARENT oForm ROWS Len(aProfession) COLUMNS 1
FOR i := 1 TO Len(aProfession)
@ i,1 DCSAY aProfession[i] PARENT oTable
NEXT
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLFORM
oHtml := DC_HtmlForm():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_SAY
oHtml := DC_HtmlSay():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
@ DCSAY
dc_htmltabgroup()
A class for creating TABPAGES in HTML
Syntax:
DC_HtmlTabGroup():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlTabGroup() is a class for creating HTML tables
that emulate GUI tab pages. The :writeHtml() method
returns the source code of the table tag and all of its
child elements.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent classes - DC_Html() and DC_HtmlTable().
Name Type Description
------------------- -------- --------------------------------
tabCount N Number of tabs
tabSelected N Currently selected tab
tabName C Tab Name
tabCaptions A Array of Tab Captions
tabColorUnselected X Color of unselected tabs
tabColorSelected X Color of selected tab
tabObject O The tab object
<þtabCountþ> is the number of tabs in the tab group.
<þtabSelectedþ> is the number of the currently selected tab.
<þtabNameþ> is a name to assign to the tab group.
<þtabCaptionsþ> is an array of character strings to use as
captions for each tab. If this array is not used, then
tabs captions, images, etc must be added to the childlist
of the <þtabObjectþ>.
<þtabColorUnSelectedþ> is the color of the tabs that are not
selected. The color may be an RGB color value (#XXXXXX) ,
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
<þtabColorSelectedþ> is the color of the tab that is currently
selected. The color may be an RGB color value (#XXXXXX) ,
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html() and DC_HtmlTable().
Parent object may be from any DC_Html*() class.
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oForm, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, oTabGroup, oTabs, aTabCaptions, ;
aMemos[4], aClass
DCFORM OBJECT oForm
DCTABGROUP ;
WIDTH '400' ;
OBJECT oTabGroup ;
TABOBJECT oTabs ;
PARENT oForm ;
SELECT 2 ;
COLOR GRA_CLR_WHITE ;
SELECTEDCOLOR GRA_CLR_GREEN ;
UNSELECTEDCOLOR GRA_CLR_PALEGRAY ;
BORDER 0 ;
CELLPADDING 0 ;
CELLSPACING 0 ;
TABS 4
aTabCaptions := {'Customer','Vendor','History','Misc'}
FOR i := 1 TO Len(aTabCaptions)
DCSUBMIT ;
TYPE DCHTML_BUTTONTYPE_SUBMIT ;
CAPTION aTabCaptions[i] ;
PARENT oTabs ;
NAME 'App.Tab' + Alltrim(Str(i))
aMemos[i] := 'This is the ' + aTabCaptions[i] + ' Memo'
@ 0,0 DCMULTILINE aMemos[i] SIZE 60,10 ;
PARENT oTabGroup
NEXT
aClass := { { GETLIST_HTMLFORM , {|o,a|DC_HtmlForm():new(o,a)} }, ;
{ GETLIST_HTMLTABGROUP, {|o,a|DC_HtmlTabGroup():new(o,a)} }, ;
{ GETLIST_MLE , {|o,a|DC_HtmlMle():new(o,a)} }, ;
{ GETLIST_HTMLSUBMIT , {|o,a|DC_HtmlSubmit():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
DCTABGROUP
dc_htmltable()
A class for creating a TABLE in HTML
Syntax:
DC_HtmlTable():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlTable() is a class for creating HTML tables. The
:writeHtml() method returns the source code of the table
tag and all of its child elements.
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
--------------------- ------- --------------------------------
tableTrimColumns L Remove empty end columns
tableTrimRows L Remove empty end rows
tableRows N Number of rows in table
tableColumns N Number of columns in table
tableHSpace N Horizontal spacing of cells
tableVSpace N Vertical spacing of cells
tableFill C Fill string for each cell
tableWidth N/C Width of table
tableCellPadding N Cell padding
tableCellSpacing N Cell spacing
tableBorderColor C Border color
tableBorderColorDark C Border color dark
tableBorderColorLight C Border color light
tableBorder N Border width
tableAlign C/N Horizontal alignment
tableVAlign C/N Vertical alignment
tableBGColor C Background color
tableHeaders A Array of headers
tableFooters A Array of footers
tableClass C Class of table
<þtableTrimColumnsþ> if .TRUE. will suppress writing <þtdþ><þ/tdþ>
column tags that are empty when at the end of columns.
<þtableTrimRowsþ> if .TRUE. will suppress writing <þtrþ><þ/trþ>
column tags that are empty when at the end of rows.
<þtableRowsþ> is the number of rows in the table.
<þtableColumnsþ> is the number of columns in the table.
<þtableHSpaceþ> is the number of pixels of space on the
outside of the table on both the left and right side.
<þtableVSpaceþ> is the number of pixels of space on the
outside of the table on both the top and bottom.
<þtableFillþ> is a character string to put into each table
cell. Any writing to the cells will be appended to the
fill string.
<þtableWidthþ> is a character string defining the width of
the table. Values may be either an integer--interpreted
as a number of pixels--or a character string defining a
percentage of the horizontal or vertical space. The
value 50% means half the available space while 50 means
50 pixels.
<þtableCellPaddingþ> defines the amount of space within table
cells (i.e., between the border and cell contents). The
value may be given as a number of pixels or as a percentage,
though most browsers do not support percentages, treating
"20%" as if it were "20". A percentage value is relative to
the vertical space available for vertical padding or spacing,
and the amount is split evenly between the top and bottom.
Horizontal padding and spacing behave similarly. The padding
or spacing is always applied to all four sides.
<þtableCellSpacingþ> defines the amount of space between
table cells.
Internet explorer lets you alter the colors that make up an
individual cell's border - if border are turned on with the
border attribute. The values for <þtableBorderColorþ>,
<þtableBorderColorDarkþ> and <þtableBorderColorLightþ> may be
an RGB color value (#XXXXXX) , a standard color name, an
RGB 3-element array or a numeric value defined in GRA.CH.
The different colors shade the edges of the border to give
it a 3D appearance with <þborderColorþ> shades the central
body of the border.
<þtableBorderþ> specifies the width in pixels of the border
around the table.
<þtableAlignþ> specifies the default horizontal alignment of
items in the table cells. Possible values are left, right,
and center.
<þtableVAlignþ> specifies the default vertical alignment of
items in the table cells. Possible values are top, bottom,
and center.
<þtableBGColorþ> specifies the default background color for
the entire table. Value may be an RGB color value (#XXXXXX),
a standard color name, an RGB 3-element array or a numeric
value defined in GRA.CH.
<þtableHeadersþ> is an array of character strings containing
the headers for each column in the table. The length of
the array should be equivalent to the number of columns.
<þtableFootersþ> is an array of character strings containing
the footers for each column in the table. The length of
the array should be equivalent to the number of columns.
<þtableClassþ> sets a class name for the table. The class name
is case sensitive. A class is used with style sheets to
give the table a pre-defined appearance.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object may be from any DC_Html*() class.
Child objects may be from any DC_Html*() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Main()
LOCAL i, GetList[0], oTable, oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock
DCTABLE OBJECT oTable ROWS 5 COLS 4
@ 2,3 DCHTML TEXT 'This is some text' PARENT oTable
@ 4,4 DCHTML TEXT 'This is some more text' PARENT oTable
FOR i := 1 TO Len(GetList)
aGetListItem := GetList[i]
IF Valtype(bBlock := aGetListItem[bGETLIST_PARENT]) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF aGetListItem[nGETLIST_TYPE] == GETLIST_HTML
oHtml := DC_Html():new(oParent,aGetListItem)
ELSEIF aGetListItem[nGETLIST_TYPE] == GETLIST_HTMLTABLE
oHtml := DC_HtmlTable():new(oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := aGetListItem[bGETLIST_GROUP]) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
dc_htmlvars()
A class for managing HIDDEN variables in HTML
Syntax:
DC_HtmlVars():new( [ < oParent > ], ;
< aGetListItem > ) - > self
Arguments:
< oParent > is the parent object. It must be already initialized
and must be of the DC_Html*() class.
< aGetListItem > is the item of the GetList associated with
this class.
Description:
DC_HtmlVars() is a class for managing hidden variables
in HTML applications.
The :writeHtml() method returns the source code of the
element tags.
Variables are received from an HTML form in GET or POST
HTTP requests. The Alaska Software WAA and Boris Borzic's
XB2.NET handle these variables in a similar manner and
make them available as a 2-dimensional array which each
sub-array containing the name and the value. Many times
it is desirable to replicate these variable names and
their values in the HTML response. These are referred to
as "hidden" variables and are inserted into the HTML source
as <þINPUT type=hiddenþ> elements. The is the way HTML
applications manage the state of an application without
requiring the use of cookies or other state management
techniques such as static variables. By replicating
hidden variables, the application will always work and
will not fail due to server connection timeouts or the
user turning off "cookies".
Exported Instance Variables:
The following instance variables are in addition to those
of the parent class - DC_Html().
Name Type Description
--------------------- ------- --------------------------------
sysVars A Array of system vars
include A Array of additional new vars
exclude A Array of vars to exclude
<þsysVarsþ> is a 2-dimensional array containing all the
system variables passed in to the application from the
HTTP handler.
<þincludeþ> is a 2-dimensional array containing any additional
vars.
<þexcludeþ> is a 1-dimensional array containing the names
of vars in <þsysVarsþ> to exclude. This array may contain
names with * wildcard characters.
Methods:
:Init( [<þoParentþ>], ;
<þaGetListItemþ> ) -þ> self
<þoParentþ> is the parent object. It must be already initialized
and must be of the DC_Html*() class.
<þaGetListItemþ> is the item of the GetList associated with
this class.
----------------------------------------------------
:WriteHtml( [<þnLevelþ>] ) -þ> cHtml
<þnLevelþ> is the level of indent required in the HTML source
code. The default is 0. Each DC_Html*():writeHtml() method
called in the heirarchy receives an increasing level so the
code will be indented by parent/child relationships.
Notes:
Inherits from DC_Html().
Parent object must be from DC_HtmlForm() class.
Examples:
#include "dcdialog.ch"
#include "dchtml.ch"
FUNCTION Xtest()
LOCAL i, GetList[0], oHtml, oParent, cHtml, oMainHtml, ;
aGetListItem, bBlock, aClass, aVars, oForm
aVars := { { 'App.Text.1', 'some text' }, ;
{ 'App.Text.2', 'more text' }, ;
{ 'App.Text.3', 'still more text' }, ;
{ 'App.Checkbox', 'on' }, ;
{ 'App.RadioButton', 'Mint' }, ;
{ 'App.Memo', 'lots of text' }, ;
{ 'App.RecordNumber', '12' }, ;
{ 'App.Database', 'CUSTOMER' }, ;
{ 'App.Account', '40055' } }
DCFORM OBJECT oForm
DCVARS ;
PARENT oForm ;
REPLICATE aVars ;
EXCLUDE { 'App.Text.*','App.Memo' } ;
INCLUDE { { 'App.Date', Date() }, ;
{ 'App.Time', Time() } }
aClass := { { GETLIST_HTMLVARS, {|o,a|DC_HtmlVars():new(o,a)} }, ;
{ GETLIST_HTMLFORM, {|o,a|DC_HtmlForm():new(o,a)} } }
FOR i := 1 TO Len(GetList)
oParent := nil
aGetListItem := GetList[i]
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_PARENT])) == 'B'
oParent := Eval(bBlock) // get parent
ENDIF
IF (nIndex := AScan( aClass, {|a|a[1]==aGetListItem[nGETLIST_TYPE]} )) > 0
oHtml := Eval(aClass[nIndex,2],oParent,aGetListItem)
ENDIF
IF Empty(oMainHtml)
oMainHtml := oHtml
ENDIF
IF Valtype(bBlock := DC_GetBlock(aGetListItem[bGETLIST_GROUP])) == 'B'
Eval(bBlock,oHtml) // anchor object to variable
ENDIF
NEXT
cHtml := oMainHtml:writeHtml()
MemoWrit('TEST.HTM',cHtml)
RETURN cHtml
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_html()
dc_readhtml()
DCVARS
dc_settimerevent()
Set a Timer Event
Description:
DC_SetTimerEvent() is used in place of SetTimerEvent() when more
than one timer event is required to be running simultaneously.
Exported Instance Variables:
:interval (Numeric)
The interval in 1/100 seconds.
:evalBlock (Code block)
The code block that is evaluated.
:timer (Object)
A pointer to the Thread() object.
Methods:
:NEW( <þnIntervalþ>, <þbBlockþ> ) -þ> self
Creates a new instance of the DC_SetTimerEvent class.
<þnIntervalþ> is a numeric value indicating the time interval in
1/100 seconds at which the code block <þbBlockþ> is executed.
If the value zero is passed, the code block is no longer executed.
<þbBlockþ> is a code block automatically executed in a separate
thread at specific time intervals.
:DESTROY()
Destroys the thread that runs the timer loop.
Examples:
oTimer := DC_SetTimerEvent( 100, {||UpdateTime()} )
oTimer:destroy() // stop timer
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL