Page 1 of 1

[c++] Object Create obj_Text not working

Posted: Tue May 30, 2017 3:50 am
by dazamate
Hi guys,

I am trying to create a text object that displays the current day of the candle. I have the candle day sorted, but the ObjectCreate() function is not working for me.

Code: Select all

void CreateDayLabel() {
   PrintString("CreateDayLabel() called");
   char* label = "DayLabel";
   
   if( ObjectCreate(label, obj_Text, 0, Time(0), High(0)) ) {
      PrintString("Day label create success, setting object text");
      ObjectSetText(label,"UNSET DAY",16,"Impact",clRed);
   }
   else { PrintString("obj_Text create failed");  }

   // example from help file (not working either)
   PrintString("creating testObj");
   ObjectCreate("testObj", obj_Text, 0, Time(10), Close(0));
   ObjectSetText("testObj", "Test text", 12, "Arial", clYellow);
   ObjectSet("testObj", OBJPROP_VALIGNMENT, tlBottom);
   ObjectSet("testObj", OBJPROP_HALIGNMENT, taLeftJustify);

}


My first ObjectCreate attempt is always returning false, printing the fail statement.

I also copied the example from the help files, which doesn't seem to be working either.

I also tried the obj_TextLabel in the enum, didn't work.

Can anyone see what I am doing wrong?

Re: [c++] Object Create obj_Text not working

Posted: Thu Jun 01, 2017 4:09 am
by FX Helper
Hello,

Thank you for the information.

This function doesn't work at the moment, it doesn't create anything.
Our programmers know about this issue, they will try to fix it in one of the next program builds.

Re: [c++] Object Create obj_Text not working

Posted: Thu Jun 01, 2017 4:58 pm
by dazamate
FX Helper wrote:Hello,

Thank you for the information.

This function doesn't work at the moment, it doesn't create anything.
Our programmers know about this issue, they will try to fix it in one of the next program builds.


Well I wasted a lot of time trying to debug this.

If there is an issue with it, could you put a note in your documentation so others don't waste hours like I did - this was very frustrating.

I mean you even have code examples in the help file, so I was only to assume it was meant to be in working order.

Thanks.