Announcement

Collapse
No announcement yet.

Several BMP icons on the screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Several BMP icons on the screen

    Hey all.
    I am new in Picadillo development, I use this since Monday.
    I would like display several icons on my screen as button, but what is the code for that ? I search on forum, examples, libraries, but there's nothing to help me. I display a fullscreen BMP file, that's ok, but no several bmp icon to use as "ok" or "home" ... Thanks for your answer (just an example).
    Last edited by ludok34; 10th December 2014, 09:50 PM.

  • #2
    Your best bet is probably to design your screen through Workshop4 and use the gci widget library to display and interact with your designed screen.

    Comment


    • #3
      Thanks for your answer, but How I do that?
      I've already use Worshop 4, and I don't know how we can export the design of the screen ? Worshop 4 is used only for 4D systems intelligent display. How I have to use Worshop to display a bargraph for example on my Picadillo ?

      Comment


      • #4
        You work with any 3.5" 4D screen, and then export the files to SD card without programming. You can't write any software in there, just lay out the screen so it makes a .gci and a .dat file.

        Comment


        • #5
          OK thanks, I will try it in two days.

          Comment


          • #6
            OK, I try the example, it works.
            I extract from Workshop 4 a .gci & .dat files, and I display it.

            I tried to make on 2 form (made on workshop4) a SlideBar in a position on form 0, and a other SlideBar on form 1 in a different position. I success display the first slidebar, and just after the second slidebar, but once the items had appear one time, I have only Slidebar1 instead to display Slidebar0. I can't display when I want slidebar0 or slidebar1 on the screen. I would like use my widget when I want.

            Could you explain me what is widgets.selectPage(0), widgets.setPage(slidebar, 0); ( "0" is it the form number in workshop ?) ?
            Thanks for your answer.

            Here my code:

            #include <TFT.h>
            #include <SD.h>
            #include <gciWidget.h>
            #pragma parameter extra.flags=-Wl,--defsym,_min_heap_size=0x8000
            PICadillo35t tft;
            AnalogTouch ts(LCD_XL, LCD_XR, LCD_YU, LCD_YD, 320, 480);

            gciWidgetSet widgets(tft, ts, "/TEST~1");

            gciWidget *meter;
            gciWidget *angular;
            gciWidget *sw;
            gciWidget *slider;
            gciWidget *led;
            gciWidget *knob;
            gciWidget *gauge0;
            gciWidget *gauge1;
            gciWidget *button;
            gciWidget *slidebar;

            boolean switchState = false;
            int knobValue = 0;

            void setup() {
            analogWrite(PIN_BACKLIGHT, 255);
            tft.initializeDevice();
            tft.setRotation(1); // TFT Mode paysage
            ts.setRotation(1); // Tactile mode paysage

            ts.initializeDevice();
            ts.scaleX(4.3);
            ts.scaleY(3.3);
            ts.offsetY(5);

            tft.fillScreen(Color::Black);
            tft.setTextColor(Color::White);
            tft.setFont(Fonts::Default);
            if (!SD.begin(PIN_SD_SS)) {
            tft.print("Error opening SD card");
            }

            widgets.init();
            slidebar = widgets.getWidgetByName("Slider0");
            widgets.setPage(slidebar, 0);
            widgets.selectPage(0);
            }


            void loop() {
            ts.sample();
            widgets.render();

            delay(1000);
            slidebar = widgets.getWidgetByName("Slider1");
            widgets.setPage(slidebar, 1);
            widgets.selectPage(1);

            delay(1000);
            slidebar = widgets.getWidgetByName("Slider0");
            //widgets.setPage(slidebar, 0);
            //widgets.selectPage(0);
            }

            Comment


            • #7
              The widgets.setPage(...) sets the page a widget should display on. You should do this only in setup(). Page 0 is a special page which is intended to mean "all pages", though I don't think it works too well at the moment. You should use pages 1 and 2 rather than 0 and 1. They have no reference to the form numbers in workshop.

              The widgets.selectPage(...) defines which page to display.

              You have to call widgets.render() to update the display and handle any touch input. delay() is a very very bad idea since it stops everything while it delays. Instead you should use the time value returned by millis() and look to see when your delay period has passed.

              Something like (untested):

              Code:
              gciWidget *slider1;
              gciWidget *slider2;
              
              void setup() {
                  // .. all the normal stuff
                  slider1 = widgets.getWidgetByName("Slider0");
                  slider2 = widgets.getWidgetByName("Slider1");
                  widgets.setPage(slider1, 1);
                  widgets.setPage(slider2. 2);
                  widgets.selectPage(1);
              }
              
              void loop() {
                  static uint32_t ms = millis();
                  static int page = 0;
              
                  ts.sample();
                  widgets.render();
              
                  if (millis() - ms > 1000) {
                      ms = millis();
                      page++;
                      selectPage(page);
                      if (page == 2) {
                          page = 0;
                      }
                  }
              }

              Comment


              • #8
                Majenko, Thanks a lot, you are the best, that runs ! I correct 2 things and now that's all !
                You can close this post !
                I probably create a new post for this, but, Have you an example to use keyboard proposed by Workshop ? Can I use it ? How can I get the statictext ?
                Regards,

                Comment


                • #9
                  The keyboard isn't supported yet. That's a very complex widget and needs special code to both render it and work with it. It's on the cards to get it going one day. For now it's best to just provide the buttons you need as individual buttons. Not nice though...

                  Comment

                  Working...
                  X