Go Down

Topic: UTFT_Buttons Class inheritance (Read 77 times) previous topic - next topic

lutzkather

Dec 16, 2018, 09:29 am Last Edit: Dec 16, 2018, 10:17 am by lutzkather
Hello,
I am at CPP a bit more than a beginner, unfortunately my knowledge is not sufficient for my current problem. I would like to inherit the library UTFT_Buttons in my UTFT_Windows

in the Bitmap Demo is the following

UTFT myGLCD(ITDB32S,38,39,40,41);
URTouch myTouch(6,5,4,3,2);
UTFT_Buttons myButtons(&myGLCD, &myTouch);

if I want to create and inherit my class UTFT_Windows now, it looks like this in the
header file
class UTFT_Windows() : public UTFT, public URTouch, public UTFT_Buttons
{
...
}
and like this in the code

UTFT_Windows::UTFT_Windows():
UTFT(ITDB32S,38,39,40,41),
URTouch(6,5,4,3,2),
UTFT_Buttons( ???, ???) // <-- this is my problem, I don't have the addresses here, what can I do?

what can you do, someone has an idea


my current solution is to leave this in the main program

  UTFT    myGLCD(CTE28,38,39,40,41);
  URTouch  myTouch( 6, 5, 4, 3, 2);

and then pass the pointers

  UTFT_Windows(&myGLCD, &myTouch);

and then access the functions in the class using the pointers just like in the UTFT_Buttons

this is my header file

  class UTFT_Windows(): public UTFT_Buttons
  {
    ...

    protected:
    UTFT *_UTFT;
    URTouch *_URTouch;
  }

in this my code

  UTFT_Windows::UTFT_Windows(UTFT *ptrUTFT, URTouch *ptrURTouch): UTFT_Buttons (ptrUTFT, ptrURTouch)
{
  _UTFT = ptrUTFT;

   ...

  _UTFT->InitLCD();

}

the compiler doesn't complain, if everything is running I have to test it

Kind Regards

Lutz


Go Up