Discussion of article "Improve Your Trading Charts With Interactive GUI's in MQL5 (Part II): Movable GUI (II)" - page 2

 

HELP!


Your preview intrigued me and made me think that I don't need to make a class Text.  Instead, I plan on using your GUI as a base class that will be inherited by the child class of each of my unique panels.  The GUI class should contain the definition for a function Move(....) but does not contain any working code.  Each of the child classes are essentially a shell inheriting from the base class.  In addition the child class will contain a Move function which will take the x&y coordinates from the GUI onEvent function and contain code to assign these coordinates to the x y ordinates of each of the specific objects on the panel.

While I'm a good programmer, I am not so good object programmer, in fact I'm a newbie.  I am getting "clsGUI::CreatePanel - cannot access private member function"  I assume this means I need some other qualifiers to allow their use directly in the child class to resolve the error.  So far my references have not identified the solution.

The include file and program are attached and originated as your code but contain many changes i made in trying to resolve the problem. 

WARNING TO ANYONE ELSE THAT USES THIS CODE, IT CONTAINS MANY ERRORS & i BEAR NO RESPONSIBILITY


Thanks so much for your assistance


CapeCoddah

 
CapeCoddah #:

HELP!


Your preview intrigued me and made me think that I don't need to make a class Text.  Instead, I plan on using your GUI as a base class that will be inherited by the child class of each of my unique panels.  The GUI class should contain the definition for a function Move(....) but does not contain any working code.  Each of the child classes are essentially a shell inheriting from the base class.  In addition the child class will contain a Move function which will take the x&y coordinates from the GUI onEvent function and contain code to assign these coordinates to the x y ordinates of each of the specific objects on the panel.

While I'm a good programmer, I am not so good object programmer, in fact I'm a newbie.  I am getting "clsGUI::CreatePanel - cannot access private member function"  I assume this means I need some other qualifiers to allow their use directly in the child class to resolve the error.  So far my references have not identified the solution.

The include file and program are attached and originated as your code but contain many changes i made in trying to resolve the problem. 

WARNING TO ANYONE ELSE THAT USES THIS CODE, IT CONTAINS MANY ERRORS & i BEAR NO RESPONSIBILITY


Thanks so much for your assistance


CapeCoddah

On Line number 103 in .mqh file:

class clsSample : clsGUI

to 

class clsSample : public clsGUI

Problem solved.


Concept: Inheritance type ->

Here's what each type of inheritance means:

  • Public inheritance ( class Child : public Parent ): Public and protected members of the Parent class become public and protected members of the Child class, respectively. In essence, public inheritance means "is-a". For instance, a "Child" is a type of "Parent".

  • Protected inheritance ( class Child : protected Parent ): Public and protected members of the Parent class both become protected members of the Child class. This means they can be accessed from the Child class and its subclasses, but not from outside these classes.

  • Private inheritance ( class Child : private Parent ): Both public and protected members of the Parent class become private members of the Child class. This means they can only be accessed from within the Child class itself, not from its subclasses or from outside the class.

Hope it helps!

PS: use Chart Redraw otherwise it waits for a price tick.