Underline Text

Hey guys,

I’m using Daniel Taylor’s web custom controls so I can have some more flexible CSS styles in my app than having to define everything at design time with Xojo styles. It’s working pretty well, but…

I’m trying to set some text to underlined and am not having any success. I’m trying both:

TextObject.TextDecorationTD(“underline”)

and

TestObject.SetStyleTD(“text-decoration”,”underline”)

And neither work. Looking in the CSS in the browser, it’s there correctly….

<div id="GGCG48eD" class="cssWebStyleExtDemo" style="opacity: 1; visibility: visible; font-family: serif; font-size: 120%; text-align: left; border-width: inherit; border-style: inherit; text-shadow: inherit; background-image: inherit; font-weight: bold; text-decoration: underline; background-repeat: inherit inherit;">
<div style="position: absolute; left: 0px; right: 0px; top: 0px; overflow: hidden; bottom: 0px;" class="">
<p style="margin: 0px;" class="">
WebStyle And Direct<br>This WebLabel should be affected by changes to the WebStyle or direct changes. Direct changes override the WebStyle.
</p>
</div>
</div>

But it’s not underlining. I have tested the browser itself using the try-it function at w3schools.com and that works fine - so I’m thinking it’s something with Xojo?

I’ve noticed that setting underlined in Xojo’s own styles doesn’t always work either. But since the css is shown text-decoration: underline correctly, I’m not sure why it would be a Xojo thing as we are at the browser level here…

The sub div is not inheriting/propagating the text-decoration. When I try the HTML snippet at W3 it doesn’t work there either unless I set text-decoration on the sub div to underline or inherit.

I’ll have to review the .TextDecorationTD method and add additional code for control types with nested divs.

Thanks, Daniel. Is that a browser issue or a Xojo issue? I’ve got a feeling it’s browser.

I know that underlining is generally discouraged as underlines can be confused with links. But sometimes they are nice to have especially in a web app.

I’m pretty sure it’s the browser. But multiple browsers are doing it so I’m not sure it’s a bug. It might be normal behavior for propagating text-decoration.

Well, Xojo’s underline style doesn’t work either.