Struct or class type expected error in mql4

Struct or class type expected error in mql4

Manage alerts

Loading saved threads...

Ala Ben Aicha · External communityPost link
External question — Stack Overflow Stack Exchange Author: Ala Ben Aicha Original post: https://stackoverflow.com/questions/68017254 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I'm working on a MetaTrader indicator using mql4 with the object-oriented programming model. I created a view file and a controller. I get this error: 'drawPairNamesListForex' - Struct or class type expected. 'IndicatorDashboard' - Undeclared identifier. Here is the controller: int OnInit() { View IndicatorDashboard = new View(); ShowHideForexScreenerState=false; IndicatorDashboard.ButtonCreate(0,prefix1+"ShowHideForexScreenerState",0,shiftX+boxWidth*2,shiftY,boxWidth*2,boxHeight,CORNER_LEFT_UPPER,"FOREX",fontType,TaillePolice,ShowHide_Button_Text_Color,ShowHide_Button_Color,clrNONE,false,false,false,true); EventSetTimer(2); return(INIT_SUCCEEDED); } void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { int i = 0; string name = ""; int XIncrimenet = shiftX; int YIncriment = shiftY+(boxHeight*1); if(sparam==prefix1+"ShowHideForexScreenerState" && !ShowHideForexScreenerState) { ShowHideForexScreenerState = true; IndicatorDashboard.drawPairNamesListForex(); } this is the View class where I get the 'drawPairNamesListForex' method from: class View { private: public: void drawPairNamesListForex(); View(); ~View(); }; //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ View::View() { } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ View::~View() { } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ void View::drawPairNamesListForex() { int headerNumberInChart = 0; int XIncrimenet = shiftX; int YIncriement = shiftY+boxHeight; int indiceTablePairs = 0; string pairNameCleaned = NULL; int sizeSuffix = StringLen(suffixPairs); int sizePreffix = StringLen(prefixForex); int sizeAllThePair = 0; int posiitonSuffix = 0; for(int i = 0; i < ArraySize(ForexPair); i++ ) { pairNameCleaned = ForexPair[i]; if ( sizeSuffix > 0 ) { sizeAllThePair = StringLen(pairNameCleaned); posiitonSuffix = StringFind(pairNameCleaned,suffixPairs); pairNameCleaned = StringSubstr(pairNameCleaned,0,posiitonSuffix); } if ( sizePreffix > 0 ) { sizeAllThePair = StringLen(pairNameCleaned); pairNameCleaned = StringSubstr(pairNameCleaned,sizePreffix,sizeAllThePair); } this.ButtonCreate(0,prefixForex+"PairName"+IntegerToString(i),0,shiftX,YIncriement,boxWidth*2,boxHeight,CORNER_LEFT_UPPER,pairNameCleaned,fontType,TaillePolice,textHeaderColor,headerColor,clrNONE,false,false,false,true); YIncriement+=boxHeight; } }
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: Ala Ben Aicha Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/68017254 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I'm working on a MetaTrader indicator using mql4 with the object-oriented programming model. I created a view file and a controller. I get this error: 'drawPairNamesListForex' - Struct or class type expected. 'IndicatorDashboard' - Undeclared identifier. Here is the controller: int OnInit() { View IndicatorDashboard = new View(); ShowHideForexScreenerState=false; IndicatorDashboard.ButtonCreate(0,prefix1+"ShowHideForexScreenerState",0,shiftX+boxWidth*2,shiftY,boxWidth*2,boxHeight,CORNER_LEFT_UPPER,"FOREX",fontType,TaillePolice,ShowHide_Button_Text_Color,ShowHide_Button_Color,clrNONE,false,false,false,true); EventSetTimer(2); return(INIT_SUCCEEDED); } void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { int i = 0; string name = ""; int XIncrimenet = shiftX; int YIncriment = shiftY+(boxHeight*1); if(sparam==prefix1+"ShowHideForexScreenerState" && !ShowHideForexScreenerState) { ShowHideForexScreenerState = true; IndicatorDashboard.drawPairNamesListForex(); } this is the View class where I get the 'drawPairNamesListForex' method from: class View { private: public: void drawPairNamesListForex(); View(); ~View(); }; //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ View::View() { } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ View::~View() { } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ void View::drawPairNamesListForex() { int headerNumberInChart = 0; int XIncrimenet = shiftX; int YIncriement = shiftY+boxHeight; int indiceTablePairs = 0; string pairNameCleaned = NULL; int sizeSuffix = StringLen(suffixPairs); int sizePreffix = StringLen(prefixForex); int sizeAllThePair = 0; int posiitonSuffix = 0; for(int i = 0; i < ArraySize(ForexPair); i++ ) { pairNameCleaned = ForexPair[i]; if ( sizeSuffix > 0 ) { sizeAllThePair = StringLen(pairNameCleaned); posiitonSuffix = StringFind(pairNameCleaned,suffixPairs); pairNameCleaned = StringSubstr(pairNameCleaned,0,posiitonSuffix); } if ( sizePreffix > 0 ) { sizeAllThePair = StringLen(pairNameCleaned); pairNameCleaned = StringSubstr(pairNameCleaned,sizePreffix,sizeAllThePair); } this.ButtonCreate(0,prefixForex+"PairName"+IntegerToString(i),0,shiftX,YIncriement,boxWidth*2,boxHeight,CORNER_LEFT_UPPER,pairNameCleaned,fontType,TaillePolice,textHeaderColor,headerColor,clrNONE,false,false,false,true); YIncriement+=boxHeight; } }

Cancel quote

Checking account access…