WEBSTYLE Property


PLBCMP GUI Only, 10.7

square.png Objects

 

The WEBSTYLE property allows multiple HTML inline styles to be applied to a Web Object when the object is created. This property also allows a variety of HTML inline styles to be applied when PL/B Web objects are created using PLF and PWF forms. The property uses the following format:

WEBSTYLE={style}

Note the following:

  1. WEBSTYLE may be used in CREATE, SETPROP or GETPROP statements.

  2. This property only takes affect when it is used in the CREATE statement. Once created, the mode remains in effect until the object is destroyed. The SETPROP stores the WEBSTYLE string data but the HTML inline styles do not take immediate affect The GETPROP returns the last WEBSTYLE string stored for the Web Object.

  3. When the WEBSTYLE inline styles are applied by a CREATE operation, the actual interpretation and presentation of the Web object is strictly controlled by the web browser engine being used. Beware, the final presentation may have some style conflict(s) that cause unexpected results. In some cases, the 'CSS The !important Rule' can be used to elevate the inline style to force its usage.

  4.  

    Example of HTML inline style using '!important'

     

    color:red !important;

     

  5. The {style} is a literal or character variable containing one or more attributes formatted as expected for HTML inline styles. The {style} string is formatted the same as expected for the 'HTML style Attributes' where each style definition is described as follows:

  6.  

    Style_Definitions: One or more CSS properties and separated by semicolons. (e.g. style="color:blue;text-align:center")

     

    See the following links for more format details: https://www.w3schools.com/html/html_css.asp

     

    Understanding HTML Styles including inline styles: https://www.w3schools.com/html/html_styles.asp

     

    Setting the style of an HTML element: https://www.w3schools.com/TAGS/att_global_style.asp

     

    Using style attribute definition and usage: https://www.w3schools.com/css/css_important.asp

     

    Description of 'CSS The !important Rule'.

  7. Example PL/B WebStyle property string using CREATE:

  8.  

    Win

    WINDOW

     

    nVar

    FORM

    2

    ButtonWv

    BUTTON

     

    bStyle

    INIT

    "color:red;":

     

     

    "text-align:center;":

     

     

    "border: 3px solid forestgreen;"

    .

     

     

     

    WINHIDE

     

     

    SETMODE

    *WEBMODEPLF=3

     

    CREATE

    WIN=50:400:50:400, WEBOBJECT=1

    .

     

     

     

    CREATE

    Win;ButtonWv=50:80:50:150:

     

     

    "Exit":

     

     

    WEBOBJECT=1:

     

     

    WEBSTYLE=bStyle //Inline style

     

    ACTIVATE

    ButtonWv,Exit,nVar

    .

     

     

     

    SETPROP

    WIN, VISIBLE=1

    .

     

     

     

    LOOP

     

     

    WAITEVENT

     

     

    REPEAT

     

    .

     

     

    Exit

     

     

      

    STOP

     

     

     

  9. When using the PL/B 'designer', set the WebStyle property for a Web object by specifying the HTML inline style parameters.

  10.  

    Example of designer WebStyle property string:

    color:red;text-align:center;border: 3px solid forestgreen;

 

 

See Also: Object Properties, Object IO Instructions, Object Definitions

 



PL/B Language Reference