Example:
#property strict #property indicator_chart_window #include <ChartObjects\ChartObjectsTxtControls.mqh> #include <ChartObjects\ChartObjectsBmpControls.mqh> CChartObjectRectLabel rec; CChartObjectButton btn; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping rec.Create(ChartID(),"rec",0,10,10,200,200); btn.Create(ChartID(),"btn",0,205,205,5,5); btn.Selectable(true); btn.Selected(true); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- if(id==CHARTEVENT_OBJECT_DRAG && sparam=="btn") { rec.X_Size(rec.X_Distance()+btn.X_Distance()-rec.X_Distance()); rec.Y_Size(rec.Y_Distance()+btn.Y_Distance()-rec.Y_Distance()); } } //+------------------------------------------------------------------+
Well then...that is great. I haven't gone through those classes yet, and apparently I need to. Thank you very much for pulling me out of tunnel vision. I might not even need to make a new class to design what I have in mind. Thanks again.
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
Hello everyone,
I don't normally do this, but I'm at a dead end. A little bit about what I'm trying to design. I am in the process of making a new class using CWndContainer as the parent class. The idea is to have an alternative to CDialog/CAppDialog that is more customizable and not as "bulky"...kind of like a widget. As a matter of fact I used the CDialog .mqh file as a starting point. I more or less have most of the features figured out to a point for functional testing, except for one. I would like to integrate the ability to resize this container during a mouse dragging event on the bottom/right corner. I have an object there already to be used for this purpose. I have tried multiple ways to accomplish this, but none have worked out for me.
Disclaimer: I am NOT a master at MQL4. I have just started learning the language a couple of months ago. I understand that trying to make my own Class is usually beyond the expectation for that short amount of time of learning. But, that is how I learn. By challenging myself and forcing myself to figure out problems as I come across them, I retain the information much better. But, I am a quick learner and love to learn new things all the time.
With that being said, I am not looking a "spoon fed" answer. All I am looking for is 1)Is this even possible/has been done before, and 2)if it is possible, a nudge in the right direction in the form of references, forum, articles, etc. that I should look at. And, yes, I have looked at a lot of material on this website and others. I think it is possible, I just can't seem to find the answer. Any insight is greatly appreciated and thank you for your time.