Change text of an object on every second by OnTimer?

Back to topics list To post a new topic, please log in or register
avatar
29
Karish 2016.06.13 02:55
 

Hello,

A bit newbie question.., but how can i make a text of an object to change itself on every second for example:

 

text object #1 will be change every second like so:

"."

".."

"..."

"...."

"....."

and then back to "." and same loop again and again.., thank you guys!

avatar
16
Janek6191 2016.06.13 06:13 #
 
// where ProfitLabel is the object name
void OnTick(){
       
    ObjectSetString(chart_ID,"ProfitLabel",OBJPROP_TEXT,DoubleToStr(profit,2));
}
avatar
29
Karish 2016.06.13 07:26 #
 

sorry i edited the OnTick to OnTimer, please help, it support to be OnTimer...!

avatar
12992
WHRoeder 2016.06.13 14:57 #
 
  1. OnTick or OnTimer is irrelevant. You must set the text. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. string text = "12345";
    string curr = ObjectGetString(chart_ID,"ProfitLabel",OBJPROP_TEXT);
    int    len  = (StringLen(curr) % StringLen(text)) + 1;              // 1->2->3->4->5->1
    string next = StringSubstr(text, 0, len);                           // "1","12"...
    ObjectSetString(chart_ID,"ProfitLabel",OBJPROP_TEXT, next);

avatar
29
Karish 2016.06.13 19:37 #
 

@WHRoeder, thank you for your help, i understand, but the function "OnTimer()" is new for me..,

 

i'm just trying to make a simple text change every 1 second.., like so for example:

"."

".."

"..."

"...."

"....."

and then the text will return to the first text in a loop and so on every 1 second... 

 

please help..., thank you..! 

avatar
Moderator
3412
GumRai 2016.06.14 03:38 #
 
   static string text=".";
   if(text=="......")
      text=".";
   //Set the text in the object
   text+=".";

.


avatar
29
Karish 2016.06.14 11:38 #
 
Thanks!!
Back to topics list  

To add comments, please log in or register