Although I have disabled a CheckBox it works

 

Hi,

Under some conditions, I want to disable a CheckBox. So I use the following code:

CCheckBox checkbox;

checkbox.Disable() ;

I have tried also this:

checkbox.Deactivate(); 

but the checkbox still be Active and the user can check/uncheck it.

Is it a bug of MT4 or my code is wrong?

thanks

 
The same here! I cannot disable Edit Control. Tried Disable() and Deactivate() and the control is still active and user can write into it.
 
I've finally found the solution. At least for the edit control. You need to use ReadOnly() method instead of Disable() or Deactivate(). Additionally you can change the background color of the control by using ColorBackground() method.
 

I'm refreshing this topic. Using Disable() on CCheckbox is not working as expected. Although call returns true checkbox is still enabled and clickable. Is this a standard library error or something else?

--- EDIT

I checked that flag WND_STATE_FLAG_ENABLE is properly reset on the object as a result of using Disable() - seems like Disable() is working properly but the flag itself is not working.

 
It would be nice if someone from MetaQuotes could get this fixed. This issue is almost 7 years old now.
 
thakas:

Hi,

Under some conditions, I want to disable a CheckBox. So I use the following code:

CCheckBox checkbox;

checkbox.Disable() ;

I have tried also this:

checkbox.Deactivate(); 

but the checkbox still be Active and the user can check/uncheck it.

Is it a bug of MT4 or my code is wrong?

thanks

This is a bug in library, I solve this by use event on check box button click and keep value if check box clicked, like below code:

if(id==CHARTEVENT_OBJECT_CLICK && sparam == "TimeControlCheckBoxSettingPanelButton")

     {

      Print("click on time control check box");

      if(timeControl)

         timeControlValueCheckBox_terminalPanel.Checked(true);

      else  

         timeControlValueCheckBox_terminalPanel.Checked(false);  

     }
 
Mohammad-Reza Yakhyan #:

Please edit your post and use the code button (Alt+S) when pasting code.

EDIT your original post, please do not just post the code correctly in a new post.


 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".
 
Keith Watford #:

Please edit your post and use the code button (Alt+S) when pasting code.

EDIT your original post, please do not just post the code correctly in a new post.


I edited post, Thanks for your notice.
 
Sassiz Root #: keep value if check box clicked, like below code:

Your code
      if(timeControl)
         timeControlValueCheckBox_terminalPanel.Checked(true);
      else  
         timeControlValueCheckBox_terminalPanel.Checked(false);  
Simplified
      timeControlValueCheckBox_terminalPanel.Checked(timeControl);
          Increase Order after stoploss - MQL4 programming forum #1.3 (2017)
Reason: