how to code a combo box for input parameters?

Back to topics list To post a new topic, please log in or register
avatar
3
amirbabak 2011.07.18 17:47
 

how to code a combo box for input parameters?

for example, I want to add Time Frames, to be selective...(M1-M5-...MN1)

 
avatar
1815
SDC 2011.07.18 18:01 #
 

I dont believe its possible to do this, for some reason metaquotes didnt consider that neccessary which in my opinion is stupid considering they use combo boxes in their own built in indicators, and in the properties box for custom indicators bools automaticaly have a dropdown with two choices, but as far as i know there is no way to define a custom combo box from within the code or make dropdown menues for input parameter choices.

 
avatar
12985
WHRoeder 2011.07.18 20:08 #
 
  1. amirbabak:
    how to code a combo box for input parameters?
    Buttons & Textfields on mt4 chart possible now - MQL4 forum
  2. I want to add Time Frames, to be selective...(M1-M5-...MN1)
    Just use a string and let the user enter M1 or H4, parse the string in init
    extern string TF.M1_M30_H1_MN1 = "H1";
    int TF.selected=0;
    int init(){
        int     TFperiod[]  = { PERIOD_M1,  PERIOD_M5,  PERIOD_M15, PERIOD_M30,
                                PERIOD_H1,  PERIOD_H4,  PERIOD_D1,  PERIOD_W1,
                                PERIOD_MN1  };
        string  TFtext[]    = { "M1",       "M5",       "M15",      "M30",
                                "H1",       "H4",       "D1",       "W1",
                                "MN1"       };
        for(int index=ArraySize(TFtext)-1; index >= 0; index--){
            if (TF.M1_M30_H1_MN1 == TFtext[index]) TF.selected = TFperiod[index];
        }
    }
    

 
avatar
3
amirbabak 2011.07.18 21:45 #
 
WHRoeder:
  1. amirbabak:
    how to code a combo box for input parameters?
    Buttons & Textfields on mt4 chart possible now - MQL4 forum
  2. I want to add Time Frames, to be selective...(M1-M5-...MN1)
    Just use a string and let the user enter M1 or H4, parse the string in init


thanx dear WHRoeder for the Link and Code.

therefore it's not possible to do it(making a Combo Box for input parameters), as SDK said.

 
avatar
2
lp7631010 2011.07.19 07:10 #
 

good!

avatar
2
avatar
83
BeLikeWater 2014.12.16 19:15 #
 
I dont know how the input list has not been created..
avatar
2017
gooly 2014.12.16 19:59 #
 
amirbabak:

how to code a combo box for input parameters?

for example, I want to add Time Frames, to be selective...(M1-M5-...MN1)

You can use mt4's enum:

// prices:
input ENUM_APPLIED_PRICE Prc = PRICE_CLOSE;
// time-Frames
input ENUM_TIMEFRAMES TF = PERIOD_M5;
...

or you even define you own 'combo box' by enum:

enum __in{ 
   _p1, // value 1
   _p2, // value 2
   _p3, // value 3
   _p4  // value 4 
};
extern __in check = _p1;


Back to topics list  

To add comments, please log in or register