How set specific values for external variables?

 

Hi all,

I have this extern variable in my EA that is called "index". Before the EA runs in the main window, I would need the user to select one out of three pre-determined values (for example, the three values could be 0,1,2 and the user selects 1). However, to choose one of the values, the user needs to manually click the input field and press '1' on the keyboard which is very troublesome. Is there a way I could alter the code in which I can allow the user to simply click a dropdown box beside the input value and the three values will be shown in the dropdown box - and the user can select by CLICKING one of them instead of having to type it out? Thanks! 

 
Tommy Lee:

Hi all,

I have this extern variable in my EA that is called "index". Before the EA runs in the main window, I would need the user to select one out of three pre-determined values (for example, the three values could be 0,1,2 and the user selects 1). However, to choose one of the values, the user needs to manually click the input field and press '1' on the keyboard which is very troublesome. Is there a way I could alter the code in which I can allow the user to simply click a dropdown box beside the input value and the three values will be shown in the dropdown box - and the user can select by CLICKING one of them instead of having to type it out? Thanks! 

enum iIndex {1,2,3};

// Input Variable ------------------------------------------------------------------
input iIndex  MyIndex = 1;
 
Mohamad Zulhairi Baba:

Hi Zulhari!

I got this error when I tried to compile my file. Could you help me to see what's wrong? Thank you very much! Really appreciate it!

 
Tommy Lee:

Hi Zulhari!

I got this error when I tried to compile my file. Could you help me to see what's wrong? Thank you very much! Really appreciate it!

Sorry, my honest mistake there.
custom enum shouldn't be an integer (because it's index as integer already).

use something like below;

enum iIndex {Option1,Option2,Option3};

// Input Variable ------------------------------------------------------------------
input iIndex  MyIndex = Option1;
 
try this 
enum iIndex {one,two,three};
input iIndex MyIndex = one;
//......
ObjectCreate(0,..., MyIndex + 1);
MyIndex values are  0 ,1 & 2