Questions from Beginners MQL4 MT4 MetaTrader 4 - page 218

 
Maxim Kuznetsov:

// задержка 500 милисекунд, годная для тестера

Tucked away in a mink

 
Good evening. Help me find at least one (I haven't found any on the Internet) Expert Advisor based on Fibonacci extension with open source code please.
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
При создании графического объекта функцией ObjectCreate() необходимо указать тип создаваемого объекта, который может принимать одно из значений перечисления ENUM_OBJECT. Дальнейшие уточнения свойств созданного объекта возможно с помощью функций по работе с графическими объектами.
 

I'm trying to understand objects, there is an example in MQL4 Reference Manual where pressing a button (pressed/unpressed) changes the picture. The button has two states. So my question is how to make a button has, for example, 3 states or more? I want for each state of the button its own picture. If it is impossible to do this with this function, then what function to achieve the desired result?

//--- установим картинки для режимов On и Off
ObjectSetString(chart_ID,name,OBJPROP_BMPFILE,0,file_on)
ObjectSetString(chart_ID,name,OBJPROP_BMPFILE,1,file_off)

//--- установим, в каком сотоянии находится метка (нажатом или отжатом)
   ObjectSetInteger(chart_ID,name,OBJPROP_STATE,state);
 
Nauris Zukas:

I'm trying to understand objects, there is an example in MQL4 handbook where pressing a button (pressed/unpressed) changes the picture. The button has two states. So my question is how to make a button has, for example, 3 states or more? I want for each state of the button its own picture. If you can not do this with this function, what function to achieve the desired result?


Is it like `? Pressed, half-pressed, half-repressed?
 
Vladislav Andruschenko:

How is it `? Pressed, half-pressed, half-repressed?

Half-pressed :)

 
Vladislav Andruschenko:

How is it `? Pressed, half-pressed, half-repressed?

Slider on 9 positions) I realised that when pressed it became light yellow, when double pressed it became yellow. But this is not a standard button.

 
Vladislav Andruschenko:

How is it `? Pressed, half-pressed, half-repressed?

Seriously? So hard to understand even if you read further about the desired result?
Every time you click on a picture, the picture changes. For example 5 pictures, each picture will change every time you click on it, and so on and so on.
Just OBJPROP_STATE was just right, if you wanted to change 2 pictures in a circle, but over more than two.

 
Nauris Zukas:

Really? So hard to understand even if you read further about the desired result?
Every time you click on a picture, the picture changes. For example 5 pictures, each picture will change each time you click and so on in a circle.
Just OBJPROP_STATE was just right, if you wanted to change 2 pictures in a circle, but over more than two.

It's hard to understand what's going on here. We have to explain everything to everyone.
 
Nauris Zukas:
Just OBJPROP_STATE was fine if you needed to change 2 pictures in a circle, but over more than two.

Possible solution: create several OBJ_BITMAP_LABEL objects one by one. Clicking on the first object deletes it and creates a second one in the same place. After the second object, a third object is created. For both OBJPROP_BMPFILE modes , you load the same image and do not track the state of the click, but track the name of the existing object. This name will tell you the current state of the button.

 
Aleksei Stepanenko:

Possible solution: create several OBJ_BITMAP_LABEL objects one by one. Clicking on the first object deletes it and creates a second one in the same place. After the second object, a third object is created. For both OBJPROP_BMPFILE modes , you load the same image and do not track the state of the click, but track the name of the existing object. This name will tell you the current state of the button.

Thanks, I'll give it a try!