traditional mql Objects with Panels and dialogs

 

I have a feeling that this might be a silly question to ask but i am gonna go ahead and ask (apologies in advance)

I recently came across the concept of Panels and dialogs, and they look nice ( better then the traditional mql graphical Objects like rectangles and buttons etc in most cases ),

since i am only experienced in Mql graphical objects ( ObjectCreate()  ) , and its my first time seeing the Panels and dialogs and "include files" related to this ,

is it possible to use the usual mql graphical objects ( ObjectCreate() ) to draw objects inside of the Panels and dialogs, in mql4/mql5 ? 

 
Yes and i recommend doing it that way.
 
Marco vd Heijden:
Yes and i recommend doing it that way.

Thanks for your reply
how do we make it work , i mean when i use ObjectCreate then it places the button outside of the panel and not in the panel ?
 this is what i did :

bool CPanelDialog::CreateButton1(void)
  {
//--- coordinates
   int x1=ClientAreaWidth()-(INDENT_RIGHT+BUTTON_WIDTH);
   int y1=INDENT_TOP;
   int x2=x1+BUTTON_WIDTH;
   int y2=y1+BUTTON_HEIGHT;
//--- create
   ObjectCreate(0,"asd",OBJ_BUTTON,0,0,0);
   ObjectSetInteger(0,"asd",OBJPROP_XDISTANCE,x1);
   ObjectSetInteger(0,"asd",OBJPROP_YDISTANCE,y1);
//--- set button size
   ObjectSetInteger(0,"asd",OBJPROP_XSIZE,x2);
   ObjectSetInteger(0,"asd",OBJPROP_YSIZE,y2);
//--- succeed
   return(true);
  }

which is obviously not the correct way of doing it , could you please help out with this ?

 

Now you are trying to mix things please have a look at this https://www.mql5.com/en/search#!keyword=graphical%20interfaces&module=mql5_module_articles

Search - MQL5.community
Search - MQL5.community
  • www.mql5.com
Searching is based on morphology and is insensitive to case. All letters, no matter of their case, will be processed as lowercase. By default, our search engine shows pages, that...
 
Marco vd Heijden:

Now you are trying to mix things please have a look at this https://www.mql5.com/en/search#!keyword=graphical%20interfaces&module=mql5_module_articles

I did but i couldnt find any info about using the traditional ObjectCreate functions , as i mentioned before i am trying to draw the usual graphic objects in the panel

 

Ok well i assumed you wanted to draw everything using ObjectCreate() that way can have advantages over using the panels because those do not always work and if you code everything from scratch you can make it work in these specific cases, by coding work arounds.

If you want to use them in the mix as it appears you would have to map everything in a way that the dimensions and position coordinates correlate to one another, that would also imply fixed objects because otherwise you could drag the panel away from the buttons or, you would have to code additional functions that move the buttons witht he panel and you would most likely end up re-writing the entire thing.

You can read the specific documentation about the standard library here https://www.mql5.com/en/docs/standardlibrary/controls

And specifically about buttons here https://www.mql5.com/en/docs/standardlibrary/controls/cbutton

A good article to read is this https://www.mql5.com/en/articles/4503

Because after all these things still use the standard simple functions that you are familiar with under the hood.

So you can say that you think they look better, but this doesn't really make sense, since they are one and the same thing.

It's just layered elements of the same things.

Graphical controls on the AppWindow panel

Documentation on MQL5: Standard Library / Panels and Dialogs / CButton
Documentation on MQL5: Standard Library / Panels and Dialogs / CButton
  • www.mql5.com
//|                                               ControlsButton.mq5 | //|                        Copyright 2017, MetaQuotes Software Corp. | //|                                             https://www.mql5.com | //| defines                                                          |  INDENT_LEFT                         (11)      ...
Reason: