Errors, bugs, questions - page 1376

 
Vladimir Pastushak:

We set all parameters and all parameters are saved except the fat type...

Colour size all saved after reloading only fat type is deleted...

Yes. Correct. OBJPROP_TOOLTIP is deleted when the terminal is closed. But the object itself remains. When you try to create such an object directly, you cannot create it and therefore, you cannot change its parameters and OBJPROP_TOOLTIP in particular.
 
Vladimir Pastushak:

We set all parameters and all parameters are saved except fat type...

Colour size all is saved after reloading only Tol type is deleted...

Do the same and forget it like a bad dream ;)

//+------------------------------------------------------------------+
//| Создает кнопку                                                   |
//+------------------------------------------------------------------+
   void CGraphClass::ButtonCreate(const long chart_id=0,               // ID графика
                     const string            name="Button",            // имя кнопки
                     const int               sub_window=0,             // номер подокна
                     const int               x=0,                      // координата по оси X
                     const int               y=0,                      // координата по оси Y
                     const int               width=50,                 // ширина кнопки
                     const int               height=18,                // высота кнопки
                     const ENUM_BASE_CORNER  corner=CORNER_LEFT_UPPER, // угол графика для привязки
                     const string            text="Button",            // текст
                     const string            font="Arial",             // шрифт
                     const int               font_size=10,             // размер шрифта
                     const color             clr=clrBlack,             // цвет текста
                     const color             back_clr=C'236,233,216',  // цвет фона
                     const color             border_clr=clrNONE,       // цвет границы
                     const string            tooltip="\n",             // описание объекта
                     const bool              state=false,              // нажата/отжата
                     const bool              back=false,               // на заднем плане
                     const bool              selection=false,          // выделить для перемещений
                     const bool              hidden=true,              // скрыт в списке объектов
                     const long              z_order=0)                // приоритет на нажатие мышью
     {
      if(ObjectFind(name)<0) ObjectCreate(chart_id,name,OBJ_BUTTON,sub_window,0,0);
      ObjectSetInteger(chart_id,name,OBJPROP_XDISTANCE,x);
      ObjectSetInteger(chart_id,name,OBJPROP_YDISTANCE,y);
      ObjectSetInteger(chart_id,name,OBJPROP_XSIZE,width);
      ObjectSetInteger(chart_id,name,OBJPROP_YSIZE,height);
      ObjectSetInteger(chart_id,name,OBJPROP_CORNER,corner);
      ObjectSetString(chart_id,name,OBJPROP_TEXT,text);
      ObjectSetString(chart_id,name,OBJPROP_FONT,font);
      ObjectSetInteger(chart_id,name,OBJPROP_FONTSIZE,font_size);
      ObjectSetInteger(chart_id,name,OBJPROP_COLOR,clr);
      ObjectSetInteger(chart_id,name,OBJPROP_BGCOLOR,back_clr);
      ObjectSetInteger(chart_id,name,OBJPROP_BORDER_COLOR,border_clr);
      ObjectSetInteger(chart_id,name,OBJPROP_BACK,back);
      ObjectSetInteger(chart_id,name,OBJPROP_STATE,state);
      ObjectSetInteger(chart_id,name,OBJPROP_SELECTABLE,selection);
      ObjectSetInteger(chart_id,name,OBJPROP_SELECTED,selection);
      ObjectSetInteger(chart_id,name,OBJPROP_HIDDEN,hidden);
      ObjectSetString(chart_id,name,OBJPROP_TOOLTIP,tooltip);
      ObjectSetInteger(chart_id,name,OBJPROP_ZORDER,z_order);
     }
//+------------------------------------------------------------------+
 
Artyom Trishkin:

Do the same and forget it like a bad dream ;)

With this approach, the properties of the button will change on every tick...
 
Vladimir Pastushak:
With this approach, the properties of the button will change on every tick...
And you have to create button once - at OnInit.
 
Vladimir Pastushak:
With this approach, the properties of the button will change on every tick...

That's strange. In my case, they do not change on every tick, but remain as I need and set by me, and I always create button when I need it, not in OnInit(), as Vladimir advises.

I always send the button the property type I want when I need it.

 
Karputov Vladimir:
Create a button once - at OnInit.
What if the number of buttons is dynamic?
 
Vladimir Pastushak:
And if the number of buttons is dynamic?

Create when you need to - it will always be when you want it to be. You don't need to invent problems - check them out. All the same, you will be able to change the tooltips on the fly, depending on the situation. But the button will not get re-created, but its parameters will change according to the new parameters passed to the function.

ZS. I can record you a video of how descriptions (tooltips) of one object change depending on the state of other objects.

 
Artyom Trishkin:

Create when you need to - it will always be when you want it to be. You don't need to invent problems - check them out. All the same, you will be able to change the tooltips on the fly, depending on the situation. But the button will not be created anew, but its parameters will change in accordance with the new parameters passed to the function.

SZZ. I can record you a video of how descriptions (tooltips) of one object change depending on the state of other objects.

I would be happy to watch it.
 
Vladimir Pastushak:
I'd love to see it.
Well, not tonight - it's late. It's bedtime.
 
Vladimir Pastushak:

I create some interface, with buttons, when I create a tooltip. When I restart the terminal, the tooltip is removed and I have to write it in again...

Here's a simple code that creates a button with a tooltip and after you reboot the tooltip disappears, try it...

Here's how it works.

   if(ObjectCreate(chart_ID,name,OBJ_BUTTON,sub_window,0,0))
     {
      ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
      ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
      ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);
      ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);
      ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
      ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
      ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
      ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
      ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_COLOR,border_clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
      ObjectSetInteger(chart_ID,name,OBJPROP_STATE,state);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
      ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
     }
   ObjectSetString(chart_ID,name,OBJPROP_TOOLTIP,"ROP_TOOLTIP");

This has already been pointed out to you in Service Desk...