Problem with OBJPROP_XDISTANCE setting text at different spacing at different computers

 

I have three labels that pop up in a custom indicator at the same OBJPROP_YDISTANCE value (all in the same row) but are spaced at different OBJPROP_XDISTANCE values to create columns. Everything works fine on my computer and most other but one of my beta testers has an issue where the three labels are not spaced far enough apart. The text is overlapping and enlarging the OBJPROP_XDISTANCE value fixes the problem on his computer, but if I use his OBJPROP_XDISTANCE values on my computer this it goes off the screen. I played around with the resolution on his computer and my computer and that did not simulate or fix the problem in either case. I could include an extern variable for an OBJPROP_XDISTANCE coefficient but I’m going to have hundreds of people using this I want it to be a simple as possible.

OBJPROP_XDISTANCE is the Integer value to set/get anchor X distance object property in pixels.

The font I am using is Arial. I know it’s not a equally spaced font like Courier but that shouldn’t make a difference, Plus I don’t want to use Courier because it is much to wide and all my text my not fit on screens with low resolution. Any Ideas?

Here is the loop I am using to create the first two labels

void create_lable(string name, string value,double x,double y,bool warning)

{string font = "Arial";
int font_size = 10;
ObjectCreate(name,OBJ_LABEL,1,0,0);
ObjectSet(name,OBJPROP_XDISTANCE,x);
ObjectSet(name,OBJPROP_YDISTANCE,y);
ObjectSetText(name,name,font_size,font,White);
WindowRedraw();
ObjectCreate(name+"v",OBJ_LABEL,1,0,0); // only used for results values
ObjectSet(name+"v",OBJPROP_XDISTANCE,x+265);
ObjectSet(name+"v",OBJPROP_YDISTANCE,y);
ObjectSetText(name+"v",value,font_size,font,White);
WindowRedraw();

An example of the Indicator

 

Those distances are in screen pixels

If the resolution of the monitor is different, your results may be visually different.

1024x768 will look different than on a 1600x1200 or a newer 1440x 900

One thing I did on a project was to let the user move one of the labels, then have
the code detect it is moved, and realign the others with it.

 
phy:

Those distances are in screen pixels

If the resolution of the monitor is different, your results may be visually different.

1024x768 will look different than on a 1600x1200 or a newer 1440x 900


But when I change my screen resolution on my screen the spacing is still the same. Here is the indicator try it yourself.

Files:
fr_results.mq4  20 kb
 

Well, looks OK here too.

23 objects, two columns, no overlap, three columns when there is a trade on.

There is a DPI setting in the PC Display options (not MT4), mine is set to 96, what is yours, what is his?

(didn't SEEM to do anything to MT4 here)

 

No more ideas...

Got a screenshot from the one that is bad?

Is "Arial" intalled on the balky machine?

 
Ok it was the DPI setting his was at 150. I guess I will need to learn to write a Dll to find the DPI setting.
 

phy 2007.10.08 20:59 # One thing I did on a project was to let the user move one of the labels, then have

the code detect it is moved, and realign the others with it.


Hai Phy....

I interest with your way...please give me code to do that..( i hope you did't use dll import) .Thanks

I need to draw a group of label in start off Chart Shift, but theris no ease way to do that.

So... your way is best that i can do

 
Repions:


phy 2007.10.08 20:59 # One thing I did on a project was to let the user move one of the labels, then have

the code detect it is moved, and realign the others with it.


Hai Phy....

I interest with your way...please give me code to do that..( i hope you did't use dll import) .Thanks

I need to draw a group of label in start off Chart Shift, but theris no ease way to do that.

So... your way is best that i can do


Do you really expect a reply to a 6 year old thread ?

Please do not dredge up ancient threads unless you have a very good reason to do so.


Thread start date - 2007.10.08

 

Hahahaha.....

I just try....nothing to loos...qiqiqiii..RaptorUK

May be you can help me..!.. Thanks

 
Reason: