Alaska Software Inc. - Can We Use CSS with XbpHTMLWindow?
Username: Password:
AuthorTopic: Can We Use CSS with XbpHTMLWindow?
Clayton Jones Can We Use CSS with XbpHTMLWindow?
on Thu, 29 Oct 2015 13:00:34 -0400
Hello,

Has anyone successfully used CSS with XbpHTMLWindow?  I have tried the
following approach and the object is successfully created, but when
the dialog window is shown I get a runtime error in the
XbpHTMLStyle:draw() method (error log text below):

***** this code is from one of the XPP help topics
cCSS := ".mystyle { color: #ee99aa; }" +;
            ".mystyle:hover { color: #ff0000; }"

oStyle := XbpHTMLStyle():New( cCSS )
oStyle:MinHeight := 52

cHTML := '<p class="mystyle">My fancy HTML text</p>'

***** this is my code
oHtm := XbpHTMLWindow():new()
oHtm:HTML := cHTML
oHtm:VisualStyle := oStyle 
oHtm:create(...)  

oDlg:show()    Crash!

Note: On screen the XbpHTMLWindow object appears correctly with the
text "My fancy HTML text", but then the error msg box appears.

Error log:

Xbase++ version     : Xbase++ (R) Version 2.00.629
Operating system    : Windows 7 06.01 Build 07601 Service Pack 1
------------------------------------------------------------------------------
oError:args         :
          -> VALTYPE: C VALUE: <html><head>.mystyle { color: #ee99aa;
}.mystyle:hover { color: #ff0000; }</head><body style="margin: 0px">
          -> VALTYPE: U VALUE: NIL
oError:canDefault   : N
oError:canRetry     : N
oError:canSubstitute: Y
oError:cargo        : NIL
oError:description  : Parameter has a wrong data type
oError:filename     : 
oError:genCode      :          2
oError:operation    : <<html><h...> + <NIL>
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :          3
oError:subSystem    : BASE
oError:thread       :          2
oError:tries        :          0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
(EVM Event Dispatcher)
Called from XBPHTMLSTYLE:DRAW(2852)
Called from XBPSTATIC:DRAW(2367)

*****************************************************
This may be the wrong approach.  If anyone has done this can you show
some sample code?  Thanks very much.


Regards,
Clayton

Clayton Jones   www.cjcom.net 
 Top-Down Library for Xbase++
 X-DBU Database Utility   
 X-MEMO Memo Field Replacement
 Spell-X  Spell Checking for Xbase++
Nestor G. TorresRe: Can We Use CSS with XbpHTMLWindow?
on Tue, 03 Nov 2015 06:53:54 +0200
Hi Clayton,

I'm just taking an educated guess.

I would try it this way (I would think you would have to target the 
class within oStyle ) -

oStyle:mystyle:MinHeight := "52px"

Note I have not used XbpHTMLStyle

Kind Regards,
Nestor

On 2015/10/29 07:00 PM, Clayton Jones wrote:
> Hello,
>
> Has anyone successfully used CSS with XbpHTMLWindow?  I have tried the
> following approach and the object is successfully created, but when
> the dialog window is shown I get a runtime error in the
> XbpHTMLStyle:draw() method (error log text below):
>
> ***** this code is from one of the XPP help topics
> cCSS := ".mystyle { color: #ee99aa; }" +;
>              ".mystyle:hover { color: #ff0000; }"
>
> oStyle := XbpHTMLStyle():New( cCSS )
> oStyle:MinHeight := 52
>
> cHTML := '<p class="mystyle">My fancy HTML text</p>'
>
> ***** this is my code
> oHtm := XbpHTMLWindow():new()
> oHtm:HTML := cHTML
> oHtm:VisualStyle := oStyle
> oHtm:create(...)
>
> oDlg:show()    Crash!
>
> Note: On screen the XbpHTMLWindow object appears correctly with the
> text "My fancy HTML text", but then the error msg box appears.
>
> Error log:
>
> Xbase++ version     : Xbase++ (R) Version 2.00.629
> Operating system    : Windows 7 06.01 Build 07601 Service Pack 1
> ------------------------------------------------------------------------------
> oError:args         :
>            -> VALTYPE: C VALUE: <html><head>.mystyle { color: #ee99aa;
> }.mystyle:hover { color: #ff0000; }</head><body style="margin: 0px">
>            -> VALTYPE: U VALUE: NIL
> oError:canDefault   : N
> oError:canRetry     : N
> oError:canSubstitute: Y
> oError:cargo        : NIL
> oError:description  : Parameter has a wrong data type
> oError:filename     :
> oError:genCode      :          2
> oError:operation    : <<html><h...> + <NIL>
> oError:osCode       :          0
> oError:severity     :          2
> oError:subCode      :          3
> oError:subSystem    : BASE
> oError:thread       :          2
> oError:tries        :          0
> ------------------------------------------------------------------------------
> CALLSTACK:
> ------------------------------------------------------------------------------
> (EVM Event Dispatcher)
> Called from XBPHTMLSTYLE:DRAW(2852)
> Called from XBPSTATIC:DRAW(2367)
>
> *****************************************************
> This may be the wrong approach.  If anyone has done this can you show
> some sample code?  Thanks very much.
>
>
> Regards,
> Clayton
>
> Clayton Jones   www.cjcom.net
>   Top-Down Library for Xbase++
>   X-DBU Database Utility
>   X-MEMO Memo Field Replacement
>   Spell-X  Spell Checking for Xbase++
>