Hello Chron
You wrote
Try this code, it works.
You wrote
Chr0n:
...
However, in mql5 it always seems to call GuiControl.draw()
...
...
However, in mql5 it always seems to call GuiControl.draw()
...
Try this code, it works.
class CFoo { public: virtual void WhoIam() { Print("CFoo"); } }; class CBar : public CFoo { public: virtual void WhoIam() { Print("CBar"); } }; void OnStart() { CFoo *foo=new CBar(); foo.WhoIam(); delete foo; }Result:
2012.07.16 13:28:46 s1 (EURUSD,H1) CBar
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey guys,
I am currently trying to create a trading panel in MQL5. As I didn't like the standard controls, I decided to create my own based on them.
I created:
- GuiControl
- GuiContainer
- GuiPanel
- GuiButton
[...]
Basically GuiControl is the base class where all others are derived from.
A GuiContainer has a list of GuiControls.
I would not like to be able to invoke a method that all these elements have, but can override (method is virtual). However, it always calls the method in GuiControl.
For example, for alle elements in a GuiContainer, I would like to call THEIR specific draw method:
for(int i = 0; i < getNumberOfControls(); i++) {
getControlAtIndex(i).draw(); //In Java, if my control was a panel, this would call GuiPanel.draw(). However, in mql5 it always seems to call GuiControl.draw()
}
Alternatively is it possible to get the class of an object? Something like
if(control instanceOf GuiPanel.class)
Thanks in Advance,
Daniel