"Own graphical panels" confusion

Back to topics list To post a new topic, please log in or register
avatar
9
nanuqcz 2015.03.05 13:36
 

Hello,
I want to create own GUI panel (with butttons etc.) for my indicator.

There is an example in MT4 called SimplePanel/SimpleDialog.mqh which has the method "CreateEdit":

bool CPanelDialog::CreateEdit(void)
{
   //--- coordinates
   int x1=INDENT_LEFT;
   int y1=INDENT_TOP;
   int x2=ClientAreaWidth()-(INDENT_RIGHT+BUTTON_WIDTH+CONTROLS_GAP_X);
   int y2=y1+EDIT_HEIGHT;
   
   //--- create
   if(!m_edit.Create(m_chart_id,m_name+"Edit",m_subwin,x1,y1,x2,y2))
      return(false);
   if(!m_edit.ReadOnly(true))
      return(false);
   if(!Add(m_edit))
      return(false);
   m_edit.Alignment(WND_ALIGN_WIDTH,INDENT_LEFT,0,INDENT_RIGHT+BUTTON_WIDTH+CONTROLS_GAP_X,0);
   
   //--- succeed
   return(true);
}


Under the "Create" section, there is the "m_chart_id", "m_name" and "m_subwin" variables. My questions are:
1) Where did they came from? There is no global variables named like this in the script. So maybe from parent class? Didn't find them in MQL documentation.
2) What do they mean? Specially "m_subwin", I have no idea what this means.

Thanks for answers.

avatar
2017
gooly 2015.03.05 14:06 #
 

Well I guess (I don't have & can't find) you'll find all  you need in SimpleDialog.mqh and in the editor's reference.


avatar
9
nanuqcz 2015.03.05 14:15 #
 

No, I can't find any info about these three variables in SimpleDialog.mqh.

Full source code of SimpleDialog.mqh here: http://pastebin.com/Hs0ADEJi.

avatar
2017
gooly 2015.03.05 14:57 #
 

Of course you can find it:

   virtual bool      Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2);

That's how Create is defined and the var.-names are self-explaning.

If you don't understand this you have to learn to code by reading the book, ...

avatar
9
nanuqcz 2015.03.05 15:23 #
 
"If you don't understand this you have to learn to code by reading the book"

Universal answer to everything I guess :-D

I understand parameters in the Create method. But:
1) I am asking about "m_subwin" variable, not "subwin". And same with other variables.
2) Also, if I admit that "subwin" variable is some magically renamed to globally visible variable "m_subwin"... What does it mean? Ok, I see it is integer. But what it is?

"and the var.-names are self-explaning."
I am sorry, bot not for me...

EDIT: Ok, I found some info about Create method and its parameters here. But still no idea how its variables is prefixed by "m_" (if it really is).


avatar
Moderator
3206
angevoyageur 2015.03.06 11:13 #
 
nanuqcz:
"If you don't understand this you have to learn to code by reading the book"

Universal answer to everything I guess :-D

I understand parameters in the Create method. But:
1) I am asking about "m_subwin" variable, not "subwin". And same with other variables.
2) Also, if I admit that "subwin" variable is some magically renamed to globally visible variable "m_subwin"... What does it mean? Ok, I see it is integer. But what it is?

"and the var.-names are self-explaning."
I am sorry, bot not for me...

EDIT: Ok, I found some info about Create method and its parameters here. But still no idea how its variables is prefixed by "m_" (if it really is).


These variable comes from the ancestor class CWnd (MQL4\Include\Controls\Wnd.mqh) :

class CWnd : public CObject
  {
protected:
   //--- parameters of creation
   long              m_chart_id;            // chart ID
   int               m_subwin;              // chart subwindow
   string            m_name;                // object name

Unfortunately, the Standard Library code is not documented. What can be found on the site can't be called documentation, it's only an enumeration of the members/function of each class.


avatar
108
eddie 2015.03.06 12:56 #
 


maybe m_ means Member and m_subwin is the index of the indicator Window (in the chart or below the chart).


eddie


avatar
9
nanuqcz 2015.03.06 17:27 #
 
Thanks, now it is clear to me :-)
Back to topics list  

To add comments, please log in or register