UTOUCH touchbutton PORTRAIT vs LANDSCAPE problem

This has me at wits end.
This sample code works fine in LANDSCAPE mode but not in PORTRAIT mode. Portrait is needed for the next project. Before running the program I do a LCD calibration in the portrait mode. The touch butttons are displayed fine but they done operate. - they don't even change color from BLUE to ORANGE to indicate the button has been pressed. Hardware CTE70 GLCD, Arduino Mega 2560, Arduino Mega Shield

Thanks

CODE

#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <TFT_Extension.h>

extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

UTFT myGLCD(CTE70CPLD,38,39,40,41);
UTouch myTouch(6, 5, 4, 3, 2);
UTFT_Buttons myButtons(&myGLCD, &myTouch);
TFT_Extension myTFT(&myGLCD, &myTouch);
#define convert(x) {myTFT.ConvertRGB(x)}
//#define TOUCH_ORIENTATION PORTRAIT
int panLeftRelay = 8; // Pan Left Touch Button to Relay on pin 8 (D8)
int panRightRelay = 9;

void setup()
{

// setup LCD
myGLCD.InitLCD(PORTRAIT);
myGLCD.setFont(BigFont);
myGLCD.clrScr();
myTouch.InitTouch(PORTRAIT);

// Setup Touch Buttons
myTouch.InitTouch(PORTRAIT);
myTouch.setPrecision(PREC_MEDIUM);
myButtons.setTextFont(BigFont);

//TFT setup commands
myTFT.ExtSetup();
startup();
}

void loop()
{
getButton();
}
void startup()
{
myTFT.SetTouchButtonColors(0, ORANGE, BLUE, FILL, ROUNDED); // (ID number, Pressed Color, Released Color, FILL/NOFILL) Page 1
myTFT.SetTouchButtonColors(1, ORANGE, GREEN, FILL, ROUNDED); // ID number, Pressed Color, Released Color, FILL/NOFILL) Page 2

myTFT.SetTouchButtonText(0, "Page 1", Big, BLUE); // (Text, Font, Color)
myTFT.SetTouchButtonText(1, "Page 2", Big, BLUE); // (Text, Font, Color)
}

void getButton()
{

if (myTFT.TouchButton_Draw(60,80,220,120, 0)) //Draw Pan Left Button, ID = 0
{
digitalWrite(panLeftRelay, HIGH); //High when button is pressed
}
else
{
digitalWrite(panLeftRelay, LOW); // Low when button is not pressed
}
if (myTFT.TouchButton_Draw(260, 80, 420, 120, 1)) //Draw Pan Right Button, ID = 1
{
digitalWrite(panRightRelay, HIGH); // iHigh when button is pressed
}
else
{
digitalWrite(panRightRelay, LOW);

}
}

myTouch.InitTouch(PORTRAIT);

// Setup Touch Buttons
myTouch.InitTouch(PORTRAIT);

Just in case it didn't work the first time? Maybe you need to call the function 9 or 10 times.

LOL. Sorry about that . The extra line is deleted. It still won't do touch in portrait mode.

Randy

Its almost like the touch button operation don't track the display coordinates in portrait mode. They display fine but don't respond to touching.

randee01:
Its almost like the touch button operation don't track the display coordinates in portrait mode. They display fine but don't respond to touching.

Almost? What else is it even vaguely like?

You have the source code. You could add Serial.print() statements to it to determine what it is doing. There might even, strange as this might sound, be clues in the code.

It seem like one or more libraries nay not be in portrait. The libraries are:

#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <TFT_Extension.h>

One or more may need to be modified to change to portrait.

In portrait mode the two touch buttons are display correctly but they don't work. In other words when the touch buttons are pressed they should change from blue to orange. Pressing either touch button has no effect. The touch buttons are displayed correctly side by side at the top of the display... BUT pressing the bottom and opposite side of the display (top and bottom as well as left to right sides are inverted ) the touch buttons work. So the top = bottom and right = left. Can the cpp file etc be changed to correct this? Oh, also using a mega2560 with mega shield. All the code (that i know of) that gives a choice is changed to PORTRAIT. Also the calibration file (ino) is first changed to Portrait, the calibration is executed and the new coordinates (X, Y, S) are entered into a .h file as instructed. So that's where I am. Any ideas?

Thanks,

From memory, you don't need to recalibrate the screen just because you are using it in portrait mode. The calibration mode (portrait or landscape) is based on the physical characteristics of the touch screen not on what mode you wish to use in a sketch.

I think you will find that the UTouch documentation will provide some answers as the CTE screens are a supported product.

That's true in theory but the libraries' x and y positions that are used in their code define how a command is applied - if that makes sense. Some of the UTouch etc commands have a choice of landscape or portrait modes so the software can track properly.... I'm using about four libraries and it may be that I have omitted a portrait or landscape command from one or more library. The portrait mode displays text and pushbuttons correctly but the pushbuttton touch areas are inverted. If the buttons are displayed side by side near the top the actual touch area is at the bottom and the bottom sides are swapped - in other words top = bottom and left = right. Not good! Please help - I'm not a programmer!
Thanks,
Randy