Web 2.0 : How to set font in a weblistbox?

I was able to change the font in a textarea, but this procedure does not seem to work for weblistboxes. How do I set the font and fontsize in weblistboxes?

I’m still struggling with setting the font for a weblistbox.

I found this guide:
https://documentation.xojo.com/topics/user_interface/web/using_google_fonts.html

And the procedure works for me when setting the font in webtextarea, but obviously I’m missing some information when trying the same on a weblistbox. Maybe I would have to apply it to each cell?

In Web 2.0, there are slight differences vs using google fonts in 1.0. Here is how I do it:

step 1: tell the app what fonts you are using. This is done in the app HTML Header:
<link href="https://fonts.googleapis.com/css?family=Cousine|Open+Sans|Montserrat&display=swap" rel="stylesheet">

I use Cousine, Montserrat and Open Sans. You cound replace Cousine with “Ubuntu+Mono” without the quotes.

Step 2: In the opening event of a control where you wish to specify a font:

    me.style.Value("font-family") = "Montserrat, sans-serif"
    me.style.value("font-weight") = "900"
    Me.Style.Value("font-size") = "250%"

Here I am specifying Montserrat, bold (I could use the inspector instead with labels and text fields) and very large. In bootstrap, 100% usually corresponds to 16. 250% corresponds roughly to a size of 40.

I have not figured out yet how to handle header fonts differently than item fonts in a listbox.

edit: fixed typos.

1 Like

oh… I just applied this to a listbox in my test program. It seems that we can do it for labels, popupmenus, textfields, buttons but not for listboxes. I don’t get it…