Method XbpHTMLStyle():draw() Foundation

Draws HTML markup into a Presentation Space.

Syntax
:draw( <oPS>, <aRect>, <cHTML>, [<nState>] ) --> lSuccess
Parameters
<oPS>
The Presentation Space object for rendering.
<cHTML>
A character string with the HTML markup. The string must be in ANSI encoding. Character strings using an OEM character set must first be converted withConvToAnsiCP().
<aRect>
An array with four elements which specify the starting and ending points of the output rectangle.
<nState>
A numeric value which specifies one of the draw states defined for Xbase Parts such as XBP_DRAWSTATE_DISABLED, for example. Different draw states can activate different styling in the CSS specified when initializing the HTML style object, and hence can produce different output when calling :draw(). Also see the :init() method for further information.
Return
Description

The :draw() method can be used to draw arbitrary HTML markup into the Presentation Space passed in the <oPS>parameter. <aRect> specifies the output area for the operation. If the representation of the HTML markup exceeds the bounds defined for the output area, the respective content is clipped.

:draw() first computes the representation of the HTML markup, then draws it to the Presentation Space. If CSS styling information was specified when instantiating the XbpHTMLStyle object by calling the method :new(), the CSS is applied to the HTML content when the representation is computed.

The <nState> parameter can be used to activate dedicated CSS styling with respect to a certain draw state. For this, the desired representation must be defined in the CSS using a set of pre-defined CSS selectors. The selectors are activated by the :draw() method depending on the value passed in the <nState> parameter. The following table lists the CSS selectors defined along with their associated draw state.

CSS selectors with their associated draw state
CSS selector Draw state
(none) XBP_DRAWSTATE_NORMAL
:hover XBP_DRAWSTATE_HOT
:disabled XBP_DRAWSTATE_DISABLED
:focus *) XBP_DRAWSTATE_FOCUS
:active XBP_DRAWSTATE_SELECTED
  1. Only activated for HTML elements which can receive input focus, eg.

In addition, a set of pre-defined CSS classes exist which can also be activated using the <nState> parameter. These CSS classes represent object draw states as well as standard UI elements such as the edit field of a combo box.

Pre-defined CSS-classes with their associated draw state
CSS class Draw state
focused XBP_DRAWSTATE_FOCUS
comboboxedit XBP_DRAWSTATE_COMBOBOXEDIT
header XBP_DRAWSTATE_HEADER

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.