LoadHTML Method


10.9, PLBCMP GUI Only

 

The LoadHTML method loads a HTML page from a file into a HTMLCONTROL object. This method uses the following format:

 

[label]

{object}.LoadHTML

[GIVING {return}] USING [*HtmlFile=]{htmlpage}[:

 

 

[*Flags=]{flags}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A HTMLCONTROL that is accessed.

return

Optional. A Numeric Variable that indicates the success or failure of the method.

htmlfile

Required. A Character String Variable or literal that contains the name of a file containing HTML.

flags

Optional. A Numeric Variable or decimal value whose value enforces specialized behaviors.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. If the value returned is zero, the ZERO Condition Flag is set. A {return} value of zero indicates that the method executed successfully.

  2. The EOS Condition Flag is always cleared.

  3. The OVER Condition Flag is set if the {return} variable it too small to receive the method result without truncation.

  4. The {flags} are defined as follows. Labels are defined in the plbmeth.inc inclusion file:
     

  5. Value

    Label

    Meaning

    0x00

     

    When all of the {flags} bits are zero, the {htmlpage} data is loaded into HTMLCONTROL and any HTML events.are enabled.

    0x04

    $HTML_USE_SCROLLBARS

    This value allows the vertical and horizontal scrollbars to be created for when using the Plbwin, Plbnet, Plbserve, and Plbwebsrv runtimes.

    0x08

    $HTML_3D_BORDER

    This bit value causes a border to be drawn around the HTMLCONTROL object. This bit value is only supported in the Plbwin, Plbnet, and Plbserve runtimes.

     

  6. The {htmlpage} file can include the 'data-plbevent={eventnames}' attribute for a HTML object that is being declared in the HTML page data string. When the 'data-plbevent' is being used, the HTML object events can only occur as follows:

  7.  

    1. The 'data-plbevent={eventnames}' must be declared for each HTML object which is to generate an event.

    2.  

      Where:

      {eventnames}
      This is a string of one or more JavaScript event names which must be separated by a whitespace character delimiter. See this URL Link for more information on events:
       

      https://developer.mozilla.org/en-US/docs/Web/Events

       
    3. The EVENTREGISTER must be executed to register the $JQueryEvent ( 200 event number ) event for a PANEL or HTMLCONTROL {object} executing the 'InnerHtml' method. In this case, the $JQueryEvent routine receives all of the HTML events declared by the 'data-plbevent' in the 'InnerHtml' data string. The ARG1 contains a JSON object string for the event data. See the EVENTREGISTER for more details on the $JQueryEvent.

    4.  

      Example of EventRegister Method:

       

      HTML object sample with 'data-plbevent' declared:

       

      <button data-plbevent='click' id='testb'>Testing</button>

       

      EventRegister Required:

       

      EVENTREG Panel,$JQueryEvent,HctlEvent, ARG1=JsonData

       

      or

       

      EVENTREG Panel,200,PanelEvent,ARG1=JsonData

       

  8. The {htmlpage} file can include the data-plbenable='on' attribute for a HTML object that is being declared in the HTML page data string. When the 'data-plbenable' is being used, the PL/B ENABLED property enables or disables those HTML objects.

  9.  

    HTML object sample with 'data-plbenable' declared:

     

    <button data-plbenable='on' data-plbevent='click' id='testb'>Testing</button>

     

  10. The {htmlpage} file can include the data-plbtabid={num} attribute for a HTML object that is being declared in the HTML page data string. When the 'data-plbtabid' is being used, the HTML objects will be placed in the PL/B tabbing order as members of the HTMLCONTROL. A data-plbtabid of zero (0) causes the HTML object to be removed from the PL/B tabbing order.

  11.  

    The HTML object sample with 'data-plbtabid' declared:

     

    <input type='text' data-plbenable='on' data-plbtabid='1' id='myEdit1'>

     

    <input type='text' data-plbenable='on' data-plbtabid='2' id='myEdit2'>

     

    <input type='text' data-plbenable='on' data-plbtabid='3' id='myEdit3'>

     

  12. A return value of zero (0) indicates success. Failures return one of the following values:

  13.  

    Value

    Meaning ...

    200

    There is a file name problem.

    201

    Unable to open the specified file.

    202

    Unable to obtain memory to read file.

    203

    Unable to read the specified file.

     

 

 

See Also: Web Technologies WebView2 Support HTMLCONTROL Method Syntax



PL/B Language Reference