GUI-O Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Multiple spaces are omitted

    Scheduled Pinned Locked Moved
    Report Bugs
    2
    5
    234
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wolerdbon
      last edited by

      It took me some time to track this issue. After nailing it down I have created the enclosed short sample Arduino sketch for demonstration. Screenshots of the screen output are also attached. After โ€˜initโ€™ the text will change after 5 seconds to illustrate the problem.

      It appears:
      At the time of creation of the labels the multiple spaces within the strings are honoured. However, if the text of the labels is changed later multiple spaces are discarded and replaced by a single space. I have tried escaping the spaces and replacing them by Unicode, but it seems the system will not be tricked ๐Ÿ˜‰

      Tested on Arduino IDE 1.8 and 2.X. Boards ESP32S3 and Nano 33 IOT. Windows 10 PC. Current Guio App running on Samsung Tab S6 Lite with current Android. Connection via WiFi.
      Cheers

      Guio_Screenshot_Init[2].jpg Guio_Screenshot_TextUpdated[2].jpg

      K 1 Reply Last reply Reply Quote 0
      • W
        wolerdbon
        last edited by

        /* BASED UPON:
        *

        • GUI-O Basic Ethernet example (using ESP32-WROOM-32)

        • Copyright (C) 2022, GUI-O Team

        • SPDX-License-Identifier: BSD-3-Clause

        • see https://forum.gui-o.com/category/10/video-tutorials
          */

          // *** Amend as required ***
          #include <WiFiNINA.h>

          // *** Amend as required ***
          static const char *ssid = "XXXXXXXXXXXXXXXXX";
          static const char *pass = "XXXXXXXXXXXXXXXXX";
          WiFiServer server(XXXXX);

        String in;

        void setup() {
        WiFi.begin(ssid, pass);
        while(WiFi.status() != WL_CONNECTED) {
        delay(500);
        }
        server.begin();
        }

        void loop() {
        WiFiClient client = server.available();
        if(client) {
        while(client.connected()) {
        if(client.available()) {
        const char c = client.read();
        in += c;
        if(c == '\n') {
        parseGuioMsg(in, client);
        in = "";
        }
        }
        }
        }
        }

        void parseGuioMsg(const String &msg, WiFiClient &client) {
        if(msg.startsWith("@init")) {
        Serial.println("GUI-O app is requesting INITIALIZATION!");
        client.println("@cls");
        client.println("@guis BGC:#FFFFFF");
        delay(100);

        // *** THIS IS WHERE THE MAGIC HAPPENS ***
        // *** Five labels of equal length are created and printed in monospaced font 10
        client.println("|LB UID:title0 X:40 Y:10 TXT:\"title0 2 3 4 5 6\" FFA:\"font10\" FSZ:3.5");
        client.println("|LB UID:title1 X:40 Y:20 TXT:\"title1 2   4   6\" FFA:\"font10\" FSZ:3.5");
        client.println("|LB UID:title2 X:40 Y:30 TXT:\"title2 2 3 4 5 6\" FFA:\"font10\" FSZ:3.5");
        client.println("|LB UID:title3 X:40 Y:40 TXT:\"title3 2 3 4 5 6\" FFA:\"font10\" FSZ:3.5");  
        client.println("|LB UID:title4 X:40 Y:50 TXT:\"title4 2 3 4 5 6\" FFA:\"font10\" FSZ:3.5");  
        client.println("|LB UID:title5 X:40 Y:80 TXT:\"-  wait 5s...  -\" FFA:\"font10\" FSZ:3.5"); 
        
        // *** Naturally, all labels have the same length
        
        delay(5000);
         
        // *** The text of the lower four labels is changed
        client.println("@title2 TXT:\"title2 a b c d e\"");
        client.println("@title3 TXT:\"title3 a   c   e\"");   
        client.println("@title4 TXT:\"title4 a              c               e\"");
        client.println("@title5 TXT:\"    ?   ?   ?   \"");    
        // ***  title2, title3 and title5 should be the same length. title4 should be wider
        // ***  please refer to screenshot: multiple spaces get reduced to a single space
        

        }
        client.flush();
        }

        K 1 Reply Last reply Reply Quote 0
        • K
          kl3m3n @wolerdbon
          last edited by

          @wolerdbon Hi!

          This seems to be a bug. I will check it and let you know!

          Thanks for bringing this to my attention!

          Best regards,
          Klemen

          1 Reply Last reply Reply Quote 0
          • K
            kl3m3n @wolerdbon
            last edited by

            @wolerdbon Hi.

            I have discovered where this bug originates from. It will be fixed with the next release!

            Thanks.

            Regards,
            Klemen

            W 1 Reply Last reply Reply Quote 0
            • W
              wolerdbon @kl3m3n
              last edited by

              @kl3m3n

              Again, thank you for the quick response!

              Greetings!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post