Drawstring ( true) not clearing the background

Posted on
  • For some reason with the font "Vector" the drawString command like

    drawString(txt, 130, 120, true);

    it's not clearing the background. It's just a simple clock and I don't want to use g.clear as it flickers the screen every second.

    Thanks for the help

  • Yeah, that's a known limitation.

    If you use g.clearRect to clear just the affected area before calling drawString the flicker shouldn't be too noticeable.

  • I tried that, but it's noticeable... And I wonder why on the DigiClock app, it seems to work fine.

  • Is there any other code between the call to g.clearRect and the call to g.drawString?

  • setFont and setFontAlign only.

    My concern is finding why


    is giving me an error Module Font7x11Numeric7Seg not found.

    The first time I tried the clock tutorial, it worked, but now throws error. Downloaded app digiClock works, however.

  • Yes, not clearing behind for Vector fonts is expected right now. I'll get a fix in for the 2v11 version though.

    Module Font7x11Numeric7Seg not found.

    Are you pasting into the left-hand side of the IDE? If a module isn't built in the IDE loads it dynamically, but it can only do that for code that you load from the right-hand side.

  • No, I'm uploading the code directly from the storage icon. That was my mistake.
    Thanks Gordon

  • Ahh, right - yes, once files are in the app loader (or using the RHS of the IDE) then any dependencies are automatically handled.

    I've heard of others uploading using the Storage icon - did you see a suggestion for that somewhere? I guess potentially the IDE could provide the option to parse JS files that are uploaded that way as well...

  • I feel using the icon a faster method because many of us prefer to edit code with an external editor, that's my suggestion. But it's great as it is.

  • many of us prefer to edit code with an external editor

    As I recently discovered: the arrow below "open file" has a "Watch and upload" option, which actually works pretty nice with external editors. (as long as you only work on a single file)

  • Thanks.
    Still trying to understand why this gives unknown font on my code

    // Load fonts 
    function myFunction(txt) {   
      g.drawString(txt, 130, 120, true); 
  • Can't see the mistake but solved by copying from draw() function.

    How to add a new clock to the "settings/select clock" menu?

  • You just need g.setFont("7x11Numeric7Seg",4); not g.setFont("Font7x11Numeric7Seg",4); :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Drawstring ( true) not clearing the background

Posted by Avatar for mg @mg