I'm using .NET C# there. I have a textbox. I assigned it a MouseClick event.

Normally the event is fired when I click the control.

But if I set the textbox's [[B]Enabled=false[/B]] or [[B]ReadOnly=true[/B]] properties, the MouseClick event is not fired.

How can I fix it?


5 Years
Discussion Span
Last Post by hericles

Why would someone click on a textbox that is disabled anyway? The whole idea of disabling the control is to show the user they can't interact with it.


They want a string that represents a "Help Description" for it to be displayed near the botton of the screen. Even if the field is disabled, the user will want to know what it's for, even though he or she can't change the selection.


Well if you disable the control, of course it isn't going to have events as it's disabled.

MouseClick does fire for ReadOnly, so not sure what your problem is there.


Got it. So if it's ReadOnly=true, it works fine. This means I should be using [ReadOnly=false; Enabled=true] for Textboxes. Thanks for the heads up.

But now I'm having this problem with ComboBoxes and RadioButtons, since they don't have the ReadOnly field... What advice could you give me to simulate the effect of ReadOnly for these controls, while leaving Enabled set to true?


I know this was considered before, but they later rejected them for the sake of "consistency" with the behavior of the other parts of the application.

If this is the only way, I guess we can live without a help text, especially that it's self-explanatory in most cases...

I appreciate your time. You guys informed me that it's impossible with the control disabled. Thanks a lot.


Glad to help. I was also wondering how the help text was supposed to work if the button wasn't disabled. Then, clicking on it to get the help text would, of course, cause it to call whatever code it handles. Not very good from a usability point of view

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.