No announcement yet.

Forms, Textboxes, SPE Mode, uoled-128-g2

  • Filter
  • Time
  • Show
Clear All
new posts

  • Forms, Textboxes, SPE Mode, uoled-128-g2

    Okay, I figured I'd put this in it's own thread to avoid hijacking somebody else's thread.

    Before I proceed to purchase these screens, I would like to understand if what I am trying to accomplish is possible.

    So we've already established that, i can save a visi widget to the sd card and address it via serial.

    What I am trying to do is have multiple "layouts" (forms) selectable and controllable via serial.

    One layout might consist of various text boxes located around the screen, some updating frequently (multiple times per second), others remaining static (showing units of measurement, for example)

    Another layout might be a custom gauge video, with a textbox overlayed atop of it.

    Using SPE, and the method of accessing forms/widgets as media, can I write text strings to these, and remotely clear them and move the cursor around in textboxes etc ?

  • #2

    Using SPE, and the method of accessing forms/widgets as media, can I write text strings to these, and remotely clear them and move the cursor around in textboxes etc ?
    Sure there is no cursor as such, but you can write strings anywhere you want using positioning commands.

    You will need to create all forums in the one program


    • #3

      Thanks for your response.

      So I understand I can write strings anywhere - but it makes constantly refreshing certain strings with new values difficult.

      I was using the freetronics oled initially, but this was too slow as it didn't have any onboard processing as do your screens.

      One nice feature about that screen was the library allowed you to create "textboxes", so say I could have the screen split into 4 sections, and write a value to each textbox, or send a reset or clear command to one textbox only, whilst not affecting the other 3.

      Could I accomplish the same thing using SPE ? IF not, how would you suggest I update fast moving values to a portion of the screen without segments of previous numbers getting left behind.

      Say for instance, if I was displaying -30.0 in one quadrant of the screen, then the value changes to 1.0. If I'm not using fixed width fonts, how do I ensure that black space is written to the screen in a predictable way without affecting other parts of the screen that I don't want to update?

      The values are changing pretty rapidly, so I don't want to overwrite the whole quadrant with a black box between updates as that will probably cause a visible flicker effect...


      • #4

        You will need to experiment a bit to find what is suitable for your font + size, expectations and other things.

        I'd try the black box bit first as it is easiest and most people find it acceptable.

        Most variable width fonts still have numbers as fixed, you might like to take this into account. Also putting the - at the end can help make things appear aligned.

        As for leading blanks vs used digits that can be a pain, once you have worked out the width of a digit in a particular font and size you can to a leading box and position the actual numbers in a calculated position. Of course this only matters if you want to keep the decimal point aligned.

        If the decimal point doesn't need aligning, try using OPAQUE characters and trailing spaces.

        Not sure how rapidly values are changing, but maybe give consideration to a slight pause after each set of updates.


        • #5

          Okay. Are there any options to "right justify" text ?

          I.e like so:

          That way, the decimal points will always be lined up assuming i use the same amount of decimal places for each value...


          • #6

            I think strwidth("string") will give you the width, so subtracting that from the 'right margin' will right align the string.


            • #7

              Okay thanks. in relation to your other post, the values are changing fairly rapidly. I could slow down the text updates so the impact of the "black box" is not noticed as much..