Go Down

Topic: Little problem with UTFT Buttons and UTFT SDRaw. (Read 2004 times) previous topic - next topic

c0rsa1r

Oct 06, 2015, 03:11 pm Last Edit: Oct 06, 2015, 03:13 pm by c0rsa1r
Hi all, I have made a code that work very well using utft and utouch libs. I have only one issue.
Tha utft buttons lib can't use the VGA_TRANSPARENT color, so I can't see the picture under the buttons.
I have the images loaded via sdraw lib and I can see them on the display, but ofc the button is on top of the image and it goes "under" the button.
I could use bitmaps, but they fill up my arduino due and I must use the sdcard.
Should I do something like "layer level" like photoshop (supposing it is possible ofc)? or I'm just doing it the wrong way?
Has someone already faced this problem?
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

I am not a fan of the UTFT_Button library, I find it very stiff. Give mine a try, there should be plenty of examples to show you how it works.

http://forum.arduino.cc/index.php?topic=316351.25
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

c0rsa1r

I am not a fan of the UTFT_Button library, I find it very stiff. Give mine a try, there should be plenty of examples to show you how it works.

http://forum.arduino.cc/index.php?topic=316351.25
Ok thank you I'll try the lib asap. Does it have "transparent" color for the buttons? Or the chance to load a RAW image from the SD lib?
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

#3
Oct 06, 2015, 09:59 pm Last Edit: Oct 06, 2015, 10:00 pm by HazardsMind
It has FILL and NOFILL options. If you set it to NOFILL then the button will have just the outline and the text with no background.

And no, it does not read RAW files from an SD card, you are basically making the button yourself.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

c0rsa1r

Ok it does work as intended with the provided examples, but when I try to load the sd lib I get this error

Code: [Select]
Arduino:1.6.5 (Windows 8.1), Scheda:"Arduino Due (Programming Port)"

In file included from _8_Buttons.ino:4:0:
C:\Users\Utente\Documents\Arduino\libraries\TFT_ExtensionV2/TFT_ExtensionV2.h:34:14: error: expected unqualified-id before numeric constant
 #define left 90
              ^
C:\Users\Utente\Documents\Arduino\libraries\SdFat/utility/ios.h:67:25: note: in expansion of macro 'left'
   static const fmtflags left       = 0x0001;
                         ^
C:\Users\Utente\Documents\Arduino\libraries\TFT_ExtensionV2/TFT_ExtensionV2.h:35:15: error: expected unqualified-id before numeric constant
 #define right 270
               ^
C:\Users\Utente\Documents\Arduino\libraries\SdFat/utility/ios.h:69:25: note: in expansion of macro 'right'
   static const fmtflags right      = 0x0002;
                         ^
C:\Users\Utente\Documents\Arduino\libraries\TFT_ExtensionV2/TFT_ExtensionV2.h:34:14: error: expected unqualified-id before numeric constant
 #define left 90
              ^
C:\Users\Utente\Documents\Arduino\libraries\SdFat/utility/ios.h:248:18: note: in expansion of macro 'left'
 inline ios_base& left(ios_base& str) {
                  ^
C:\Users\Utente\Documents\Arduino\libraries\TFT_ExtensionV2/TFT_ExtensionV2.h:34:14: error: expected initializer before numeric constant
 #define left 90
              ^
C:\Users\Utente\Documents\Arduino\libraries\SdFat/utility/ios.h:248:18: note: in expansion of macro 'left'
 inline ios_base& left(ios_base& str) {
                  ^
C:\Users\Utente\Documents\Arduino\libraries\TFT_ExtensionV2/TFT_ExtensionV2.h:35:15: error: expected unqualified-id before numeric constant
 #define right 270
               ^
C:\Users\Utente\Documents\Arduino\libraries\SdFat/utility/ios.h:312:18: note: in expansion of macro 'right'
 inline ios_base& right(ios_base& str) {
                  ^
C:\Users\Utente\Documents\Arduino\libraries\TFT_ExtensionV2/TFT_ExtensionV2.h:35:15: error: expected initializer before numeric constant
 #define right 270
               ^
C:\Users\Utente\Documents\Arduino\libraries\SdFat/utility/ios.h:312:18: note: in expansion of macro 'right'
 inline ios_base& right(ios_base& str) {


I suppose there are two constant with the same name, what should I do?
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

The ones in my library, you can put an under score in front of them ( _ ) try that
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

c0rsa1r

The ones in my library, you can put an under score in front of them ( _ ) try that
ok I'll try in some minutes. Does putting this underscore disable some essential function?
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

#7
Oct 07, 2015, 05:26 pm Last Edit: Oct 07, 2015, 05:31 pm by HazardsMind
No, it just makes it different from the other libraries that also have left , right etc.

I'll make that change in my library when I release the new version.

Added:
Ok I just changed it to Tri_up, Tri_down, Tri_left, Tri_right. I wanted something simple, but then again you can't please everyone. 
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

c0rsa1r

#8
Oct 08, 2015, 08:10 am Last Edit: Oct 08, 2015, 09:00 am by c0rsa1r
Ok thank you I'll start working on my display in a matter of minutes and try everything.
I'll post the results asap

edit: it seems that the "nofill" option actually doesn't make the button "nonfilled", but it simply makes it black. the images are just under the button, so I'm getting pretty much the same result that I had with the utftbutton lib, am I doing something wrong?
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

c0rsa1r

Code: [Select]
#include <UTFT.h>
#include <UTouch.h>
#include <TFT_ExtensionV2.h>
#include <SPI.h>
#include <SdFat.h>
#include <UTFT_SdRaw.h>
#define SD_CHIP_SELECT  42
SdFat sd;

UTFT    myGLCD(TFT01_50,22,23,31,33);
UTouch  myTouch(25,26,27,29,30);
UTFT_SdRaw myFiles(&myGLCD);

Base B(&myGLCD, &myTouch);
Box button(&B);

void setup()
{
  myGLCD.InitLCD(LANDSCAPE);
  myGLCD.clrScr();
  myTouch.InitTouch(LANDSCAPE);
  myTouch.setPrecision(PREC_EXTREME);
  myGLCD.fillScr(BLACK);
 
  Serial.begin(9600);
   while (!Serial) {
    ;
  }
  bool mysd = 0;
  while (!mysd)
  {
    if (!sd.begin(SD_CHIP_SELECT, SPI_HALF_SPEED)) {
    }
    else
    {
      mysd = 1;
    }
  }
 
  draw_Main();
 
  button.Coords(10, 10, 250, 110);
  button.Colors(NOFILL, NOFILL, NOFILL, ROUNDED);
  button.Draw();
}

void loop()
{
  button.Toggle();
}

void draw_Main()
{
  myFiles.load(10,10,240,145, "BUTTON.RAW", 32);
}
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

Quote
button.Colors(NOFILL, NOFILL, NOFILL, ROUNDED);
I have not seen anyone do that yet, but did it work for you?
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

c0rsa1r

No, unfortunately it doesn't work. It doesn't go transparent...it just goes black. I tryied to fill the screen with a color and then set the button color to transparent, but the button still remain black.
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

#12
Oct 08, 2015, 02:50 pm Last Edit: Oct 08, 2015, 02:56 pm by HazardsMind
That's because it's supposed to be an on screen button. There is no transparency. You can modify the library if you want, all you need is a simple IF statement that goes above where it says "_Disp->setColor( x )"



Just add this. (Replace the x with the color variable that is in the function then save

if( x > 0)

 _Disp->setColor( x );


Edit: Actually don't touch the library. Instead of using .Touch() in your code, just use .getTouchState() and as long as you don't use .Draw() anywhere, you should have an invisible button.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

c0rsa1r

Ok, I'll give it a go in a matter of hours, thank you again very much, you really have a lot of patience!
"The S2000 is nothing so much as a legend in its own time. If you don't like it, you probably haven't driven it hard enough." - Car culture

HazardsMind

Quote
you really have a lot of patience!
I used to work in tech support, so patience actually is a virtue.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

Go Up