CButton problem with locking

Back to topics list To post a new topic, please log in or register
user_123 2015.02.26 23:22

Hello Dear Community,

does somebody know how I can solve the problem with the "Locking" of the Cbutton? I have created a CButton on a chart with the following code. I would like to have a button which you can press, but the button should not have two states (like it is actually in my code, the button has the status "not clicked" and "clicked"). After the mouse click the button schould have the status "not clicked" again. I hope this is more or less understandable.

I've looked at the example of "SimplePanel" under the indicators, this also contains three buttons that are created with the CButton class. The buttons 1 and 2 work as my button should be. But I can not find in the example how to set this.

In the example "SimplePanel the
method m_button3.Locking(true)  was called for the third button for locking. On my button, I do not call this method but it seem like the property is set to true by default. I have tried the method MyButton.Locking(false), but this does not work. Maybe I overlooked something?

I am very grateful if someone could help me.

Thank you very much!

#property version   "1.00"
#property strict
#property indicator_chart_window
#include <Controls\Button.mqh>

CButton MyButton;

//| Custom indicator initialization function                         |
int OnInit(){

void OnDeinit(const int reason){

eddie 2015.02.28 21:37 #

Hi user_123!

The SimplePanel uses a dialog. This dialog handles the events.

In your program with only one button you have to handle the events yourself.

void OnChartEvent(const int id,

                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  if (MyButton.Pressed ( ))
    MyButton.Pressed (false);
    //insert the code to be executed if the button is pressed


user_123 2015.03.02 11:37 #
Eddie, thank you very much!
Back to topics list  

To add comments, please log in or register