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";
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
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.
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
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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
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";