anyway to insert variable into ObjectSetText without using if ?

 

I want to add a variable into the .


here is the code:


extern int wtime=10000 ;

wtime = int wtime2;
ObjectsDeleteAll();
ObjectCreate("wait_time", OBJ_LABEL, 0, 0, 0);// Creating obj.
ObjectSet("wait_time", OBJPROP_CORNER, 4); // Reference corner
ObjectSet("wait_time", OBJPROP_XDISTANCE, 10);// X coordinate
ObjectSet("wait_time", OBJPROP_YDISTANCE, 28);// Y coordinate
ObjectSetText("wait_time", (wtime2),8,"Arial",Yellow);


as I change wtime2 I want it to display on the chart without using the if statement:


if (wtime == 10000) ObjectSetText("wait_time", "int (wait-time 10 seconds",8,"Arial",Yellow);
if (wtime == 30000) ObjectSetText("wait_time", "wait-time 30 seconds ",8,"Arial",Yellow);


any help appreciated


thanx

 
buju:

if (wtime == 10000) ObjectSetText("wait_time", "int (wait-time 10 seconds",8,"Arial",Yellow);

if (wtime == 30000) ObjectSetText("wait_time", "wait-time 30 seconds ",8,"Arial",Yellow);

 ObjectSetText("wait_time", StringConcatenate("wait-time ", wtime2 / 1000., " seconds "),8,"Arial",Yellow);

here is the code:


extern int wtime=10000 ;

wtime = int wtime2;

Does this compile? Or just a typo?



BTW, there is no need to delete and recreate the label every time. It would be enough to update the text with ObjectSetText() only followed by WindowRedraw() if necessary.

 
Irtron:

Does this compile? Or just a typo?



BTW, there is no need to delete and recreate the label every time. It would be enough to update the text with ObjectSetText() only followed by WindowRedraw() if necessary.

it compiles with no errors, it just does not show the value of (wtime2).


problem is that I would have to put in 100's of "if" statements just to display the value.


btw, I already have comments displaying but the problem with that is that each comment overwrites the previous comment, unless there is a way to display comments on different lines of the chart .....?

Reason: