drop down list coding problem

 

so I'm tired f having to load all my fonts in separate program to pick one for an indicator, i managed to add them in a dropdown list on my indicator, but  they dont display as what i picked rather juist the generic default font. how do i make them relate to fonts i have installed on my computer?


example

  enum FontChoice

 { 

  lucida=1,

   jedi=2,

    helvetica=3,

     arial=4,

};

extern  FontChoice Font=  "jedi";                   //font


      ObjectSetText(Dsquare+"-lbR3",sR3+"R3 = "+DoubleToStr(xR3,Digits),FontSize,FontChoice,LevelR1);

itgives me an error for following it with a comma, and ii tried Enumtostring in a few different ways idk what im doing, i got the list to appear as a dropdown menu but thats it. how dp i tie the names of the fonts intbhe dropdownlist to fonts on my computer? i know if i put 

extern string Font = "smarker";   

it will use the font i write oin, i juts want a list there instead of an input box. can anybody help me with this?

 
robkant87:

so I'm tired f having to load all my fonts in separate program to pick one for an indicator, i managed to add them in a dropdown list on my indicator, but  they dont display as what i picked rather juist the generic default font. how do i make them relate to fonts i have installed on my computer?


example

  enum FontChoice

 { 

  lucida=1,

   jedi=2,

    helvetica=3,

     arial=4,

};


in the vartiables i put


extern  FontChoice Font=  "jedi";                   //font


when i puit the code 

      ObjectSetText(Dsquare+"-lbR3",sR3+"R3 = "+DoubleToStr(xR3,Digits),FontSize,FontChoice,LevelR1);


itgives me an error for following it with a comma, and ii tried Enumtostring in a few different ways idk what im doing, i got the list to appear as a dropdown menu but thats it. how dp i tie the names of the fonts intbhe dropdownlist to fonts on my computer? i know if i put 

extern string Font = "smarker";   

it will use the font i write oin, i juts want a list there instead of an input box. can anybody help me with this?

Your first error is:

extern  FontChoice Font=  "jedi";                   // assigns 0 to Font

it should be 

extern  FontChoice Font=  jedi;                   //assigns  jedi=2 to Font


Give it a try after correcting that

 
robkant87:

Please edit your post and use the code button (Alt+S) when pasting code.

EDIT your original post, please do not just post the code correctly in a new post.


One way that you can deal with this is

enum FontChoice
  {
   lucida=0,
   jedi=1,
   helvetica=2,
   arial=3,
  };

input  FontChoice InpFontEnum=  jedi;                   //font

string Font;
//+------------------------------------------------------------------+
//| Initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   string font_array[]={"lucida","jedi","helvetica","arial"};
   Font=font_array[(int)InpFontEnum];
   Print("Font input is ",Font);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
 
ok so i tried that i got a whole whack of errors, i dont know what to do with that clearly.
 
robkant87 #:
ok so i tried that i got a whole whack of errors, i dont know what to do with that clearly.

Show what you tried.

 
robkant87 #:
ok so i tried that i got a whole whack of errors, i dont know what to do with that clearly.

No problems with Keith's code - ran perfectly when I tried it. 

If you share your implementation and the errors it would help - in particular your ObjectSetText() so we can look further into what you are aiming to do

 
robkant87 #:
ok so i tried that i got a whole whack of errors, i dont know what to do with that clearly.
Lol ... sorry I can't stop laughing,  "whack of errors", comment the section for fonts input and work you way from there.
 
robkant87 #:
ok so i tried that i got a whole whack of errors, i dont know what to do with that clearly.
Keith Watford #:

Show what you tried.

Still waiting..............................