Mouse Hit Test: How??
-
Hello, I've a text box in a group box on a form and upon startup, this box is NOT enabled. My UI behavior is supposed to enable the box if the user double clicks on it (I cannot get messages from the box itself while not enabled). After a few hours of trying to find a method, I'm giving up and asking if anyone knows how to do this? I find it hard to believe that there's no "hit test" contained in the Rectangle or Point object types and that I cannot get a rectangle type directly from the text box itself! thanks! JennyP
-
Hello, I've a text box in a group box on a form and upon startup, this box is NOT enabled. My UI behavior is supposed to enable the box if the user double clicks on it (I cannot get messages from the box itself while not enabled). After a few hours of trying to find a method, I'm giving up and asking if anyone knows how to do this? I find it hard to believe that there's no "hit test" contained in the Rectangle or Point object types and that I cannot get a rectangle type directly from the text box itself! thanks! JennyP
By definition, the enabled property "Gets or sets a value indicating whether the control can respond to user interaction"-MSDN. It can't catch any user interaction, including the click, double-click events and the mousemove, mouseup, mousedown events that you may need to hittest. Try setting the read-only property instead. This makes the control able to receive user interaction but will still be uneditable. Good Luck!
-
By definition, the enabled property "Gets or sets a value indicating whether the control can respond to user interaction"-MSDN. It can't catch any user interaction, including the click, double-click events and the mousemove, mouseup, mousedown events that you may need to hittest. Try setting the read-only property instead. This makes the control able to receive user interaction but will still be uneditable. Good Luck!
Hello, Thanks for the suggestion. I would rather not allow the user to tab in to the control (and any other UI features) associated with an enabled control. In C++, there's hit test tools for obtaining the mouse position and comparing this to the object's rectangle and I can do most of this in VB, but cannot get the coordinates to match.... but I suspect that there is a simpler (and tried and tested) way. thanks, JennyP
-
Hello, Thanks for the suggestion. I would rather not allow the user to tab in to the control (and any other UI features) associated with an enabled control. In C++, there's hit test tools for obtaining the mouse position and comparing this to the object's rectangle and I can do most of this in VB, but cannot get the coordinates to match.... but I suspect that there is a simpler (and tried and tested) way. thanks, JennyP
You could place an image box over the control and when that is double clicked enable the text box, quick and dirty but effective "If i was king cigarettes would be free."
-
Hello, I've a text box in a group box on a form and upon startup, this box is NOT enabled. My UI behavior is supposed to enable the box if the user double clicks on it (I cannot get messages from the box itself while not enabled). After a few hours of trying to find a method, I'm giving up and asking if anyone knows how to do this? I find it hard to believe that there's no "hit test" contained in the Rectangle or Point object types and that I cannot get a rectangle type directly from the text box itself! thanks! JennyP
Hi Jenny! bitpusher wrote: I've a text box in a group box on a form and upon startup, this box is NOT enabled. My UI behavior is supposed to enable the box if the user double clicks on it (I cannot get messages from the box itself while not enabled). You're talking about a groupbox so I guess you're programming in Visual Basic .NET. I spent some thoughts about your problem and worte a little class which should do exactly what you want. Just give me another day or two to write an article and demo application.
-
Hello, I've a text box in a group box on a form and upon startup, this box is NOT enabled. My UI behavior is supposed to enable the box if the user double clicks on it (I cannot get messages from the box itself while not enabled). After a few hours of trying to find a method, I'm giving up and asking if anyone knows how to do this? I find it hard to believe that there's no "hit test" contained in the Rectangle or Point object types and that I cannot get a rectangle type directly from the text box itself! thanks! JennyP
Hi there! bitpusher wrote: My UI behavior is supposed to enable the box if the user double clicks on it (I cannot get messages from the box itself while not enabled). After a few hours of trying to find a method, I'm giving up and asking if anyone knows how to do this? Well, I just finished my new article. Maybe this will help (if it doesn't let me know): http://www.codeproject.com/useritems/CtrlActivator.asp[^] Best regards Dennis