GROUP
The HTML control displays a web page, or a string containing HTML formatted text.
A user can operate anything appearing on the page as if using a browser.
Uses
To display pages on the internet, or to display graphics/text using HTML formatting.
Styles
An HTML may additionally have any, all, or none of the following styles:
Static edge | (STATICEDGE) Draws a thin beveled border around the control. |
Client edge | (CLIENTEDGE) Draws a beveled border around the control. |
Clip siblings | (NOSIBLING) Prevents this control from drawing into any overlapping controls. |
Group | Marks this control as the first of a group of controls in which the user can move from one control to the next with the arrow keys. All subsequent controls (after this first control) belong to the same group up to the next control that has its GROUP flag set. (ie, One group ends where the next begins). |
Disabled | Control is initially disabled. You can later enable it with a call to GuiSetCtlPlacement. |
Hide | Control is hidden. You can later make it visible with a call to GuiSetCtlPlacement. |
Events
An HTML does not generate any events.
REXX Variable
An HTML must have a REXX variable associated with it only if you need to change the page it displays, or you wish to be able to change its state (with GuiSetCtlPlacement). Before opening the window containing the HTML control, you should initialize the variable to the desired URL.
Change the page via a new URL
You can dynamically change the URL (displayed page) by setting the associated variable to the new URL, and calling GuiSetCtlValue. You pass the REXX variable name for the HTML control (ie, you must have a variable associated with the control). Here we change the page to www.microsoft.com (assuming the associated variable is "MyHTML"):
MyHTML = "http://www.microsoft.com" error = GuiSetCtlValue("MyHTML")
To display an HTML file on your hard drive, specify file: (instead of http:). For example, here we display the file C:\MyPage.htm:
MyHTML = "file:C:\MyPage.htm" error = GuiSetCtlValue("MyHTML")To display a page from a compiled help (.CHM) file, specify its: (instead of http:), followed by the .CHM filename, two colons, and then the name of the page. For example, here we display the page "mypage.htm" in the file C:\MyHelpBook.chm:
MyHTML = "its:C:\MyHelpBook.chm::mypage.htm" error = GuiSetCtlValue("MyHTML")
Change the page via an HTML string
If you wish to directly pass some HTML contents to display (instead of giving the HTML control a URL and letting it fetch the page itself), then call GuiAddCtlText. You pass the REXX variable name for the HTML control, and the new contents. Here we change the page to <H2>String 1</H2><P>This is the first string.<P>:
error = GuiAddCtlText("MyHTML", "<H2>String 1</H2><P>This is the first string.<P>")You could also pass the contents of some variable:
MyVar = "<H2>String 1</H2><P>This is the first string.<P>" error = GuiAddCtlText("MyHTML", MyVar)To blank out the HTML control, omit the second arg.
Dynamically add/remove an HTML control
You can dynamically add an HTML control to an already open window by calling GuiAddCtl. You must pass a line that describes the control. The format for this line is:
HTML X, Y, Width, Height, Styles, ExtraStyles, VariableNameX and Y is the position of the top left corner of the control, relative to the window's top left corner.
Width and Height are the size of the control, in pixels.
Styles and ExtraStyles are those listed above, with each style separated by a | character.
VariableName is the variable name to be associated with the control. You can omit this if you do not need to later remove/modify the control.
For example, here we add an HTML control at an X Y position of 10, 10, with a width and height of 80 and 40, with the default styles, extra styles of CLIENTEDGE, and a REXX Variable name of MyHTML:
error = GuiAddCtl("HTML 10,10,80,40, , CLIENTEDGE, MyHtml")
You can dynamically remove an HTML control by calling GuiRemoveCtl. Here we remove the above control:
error = GuiRemoveCtl("MyHtml")