Download MetaTrader 5

Wingdings Error

To add comments, please log in or register
stitchtrader
134
stitchtrader  

Hi, A HAPPY NEW YEAR! Guys :) 

I'm struggling with Wingdings

input int Code = 221;
void OnStart()
  {
   ObjectCreate(0,"TEST",OBJ_LABEL,0,0,0); 
   ObjectSetInteger(0,"TEST",OBJPROP_XDISTANCE,200);
   ObjectSetInteger(0,"TEST",OBJPROP_YDISTANCE,200);
   ObjectSetInteger(0,"TEST",OBJPROP_FONTSIZE,20);
   ObjectSetString (0,"TEST",OBJPROP_FONT,"Wingdings");
   string Icon=CharToString((char)Code);
   ObjectSetString (0,"TEST",OBJPROP_TEXT,Icon);
   ObjectSetInteger(0,"TEST",OBJPROP_CORNER,CORNER_RIGHT_LOWER);
   ObjectSetInteger(0,"TEST",OBJPROP_ANCHOR,ANCHOR_RIGHT);
  }

With the above script, the character is garbled as below. Why is that?

 

 

But with the following parameter, it works fine. 

input int Code = 34;

 

Please try with the attached MQL5 file.

Thank you

Files:
Test.mq5 2 kb
Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
stitchtrader: 

Please try with the attached MQL5 file.

Thank you

It worked for me . . .

 

 

Have you looked at your Wingding font in Windows Charmap ? 

stitchtrader
134
stitchtrader  
RaptorUK:

It worked for me . . .

Have you looked at your Wingding font in Windows Charmap ? 

Hi, Raptor!

Really!? Thanks.

I'm using Windows 7 x64 and checked the charmap out. It seems fine (it shows 0xDD=221)

I just found out if I input from 33 to 126, it works fine, but if I input the number larger than 126,

the character is garbled.

I don't understand a thing (@σ@;

  

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
stitchtrader:

Hi, Raptor!

Really!? Thanks.

I'm using Windows 7 x64 and checked the charmap out. It seems fine (it shows 0xDD=221)

I just found out if I input from 33 to 126, it works fine, but if I input the number larger than 126,

the character is garbled.

I don't understand a thing (@σ@;

  

I'm using Windows 7 x64 Professional.  I used your code exactly as posted,  no modifications at all. Maybe it is a language issue,  either in Windows or MT5,  are you using English language or some other language ?
Alain Verleyen
Moderator
31185
Alain Verleyen  
stitchtrader:

Hi, Raptor!

Really!? Thanks.

I'm using Windows 7 x64 and checked the charmap out. It seems fine (it shows 0xDD=221)

I just found out if I input from 33 to 126, it works fine, but if I input the number larger than 126,

the character is garbled.

I don't understand a thing (@σ@;

  

Why using a char ?

The char type takes 1 byte of memory (8 bits) and allows expressing in the binary notation 2^8=256 values. The char type can contain both positive and negative values. The range of values is from -128 to 127.

Try this :

   string Icon=IntegerToString(Code);
   ObjectSetString (0,"TEST",OBJPROP_TEXT,Icon);
Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
angevoyageur:

Why using a char

I did wonder about that,  CharToString() takes a uchar,  but as the code worked for me I couldn't investigate ways of trying to fix it.
Alain Verleyen
Moderator
31185
Alain Verleyen  
RaptorUK:
I did wonder about that,  CharToString() takes a uchar,  but as the code worked for me I couldn't investigate ways of trying to fix it.

In fact, what I proposed above doesn't work. So as you noted it's better to use uchar.

input uchar Code = 221;
void OnStart()
  {
   ObjectCreate(0,"TEST",OBJ_LABEL,0,0,0); 
   ObjectSetInteger(0,"TEST",OBJPROP_XDISTANCE,200);
   ObjectSetInteger(0,"TEST",OBJPROP_YDISTANCE,200);
   ObjectSetInteger(0,"TEST",OBJPROP_FONTSIZE,20);
   ObjectSetString (0,"TEST",OBJPROP_FONT,"Wingdings");
   string Icon=CharToString(Code);
   ObjectSetString (0,"TEST",OBJPROP_TEXT,Icon);
   ObjectSetInteger(0,"TEST",OBJPROP_CORNER,CORNER_RIGHT_LOWER);
   ObjectSetInteger(0,"TEST",OBJPROP_ANCHOR,ANCHOR_RIGHT);
  }
stitchtrader
134
stitchtrader  

I'm sorry for the late reply!

Thank you, Simon & Alain 

I tried this code

   string Icon=IntegerToString(Code);
   ObjectSetString (0,"TEST",OBJPROP_TEXT,Icon);

 

but it doesnt work fine.

 

Is this the cause of that? 

https://www.google.com/search?q=127+Wingdings 

It seems there is no workaround for this :(

 

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
RaptorUK:
 Maybe it is a language issue,  either in Windows or MT5,  are you using English language or some other language ?

? ?

 

Have you tried creating the Label manually on a chart ? 

Alain Verleyen
Moderator
31185
Alain Verleyen  
stitchtrader:

I'm sorry for the late reply!

Thank you, Simon & Alain 

I tried this code

...

 

It doesn't work with an integer as I said in this post, my mistake. Have you tried with uchar instead of char ?
stitchtrader
134
stitchtrader  
RaptorUK:

Have you tried creating the Label manually on a chart ? 

I tried creating the Label from Scrpt but it didn't work

angevoyageur:
It doesn't work with an integer as I said in this post, my mistake. Have you tried with uchar instead of char ?

It didn't either but your advice was very helpful

Thank you :)


12
To add comments, please log in or register