Caps Lock Problem with DDX_ManagedControl
-
We are doing interop between MFC and a custom C# dialog control with multiple sub controls that we are hosting in a CDialog with the DDX_MangedControl. Everything works as expected until the user enters a TextBox Field with UseSystemPasswordChar=true, with the caps lock key turned on. At which time it displays a ballon message informing the user that the caps lock key is on. When the user turns the caps lock key off the whole control surface with the exception of the TextBox field it self disappears. If you let the ballon tip expire normally then the portion of the tip that was under the ballon tip does repaint. Any suggestions on how to fix this? Thanks!
-
We are doing interop between MFC and a custom C# dialog control with multiple sub controls that we are hosting in a CDialog with the DDX_MangedControl. Everything works as expected until the user enters a TextBox Field with UseSystemPasswordChar=true, with the caps lock key turned on. At which time it displays a ballon message informing the user that the caps lock key is on. When the user turns the caps lock key off the whole control surface with the exception of the TextBox field it self disappears. If you let the ballon tip expire normally then the portion of the tip that was under the ballon tip does repaint. Any suggestions on how to fix this? Thanks!
-
Well after a bit of seaching I found a example of code that supresses the tooltip popup with EM_SHOWBALLOONTIP which I then adapted as a bute force solution that works with a horible blink of the entire control. I did this by adding a timer to the base control and starting it from the text field to refresh the entire control.
tb_password.Tag = (object)timer1; public class PasswordControl : TextBox { private const int EM_HIDEBALLOONTIP = 0x1504; protected override void WndProc(ref Message m) { if (m.Msg == EM_HIDEBALLOONTIP) { System.Windows.Forms.Timer timer = (System.Windows.Forms.Timer) this.Tag; timer.Start(); } base.WndProc(ref m); } } private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); this.Refresh(); }
Does anyone have a better solution? Thanks -
Well after a bit of seaching I found a example of code that supresses the tooltip popup with EM_SHOWBALLOONTIP which I then adapted as a bute force solution that works with a horible blink of the entire control. I did this by adding a timer to the base control and starting it from the text field to refresh the entire control.
tb_password.Tag = (object)timer1; public class PasswordControl : TextBox { private const int EM_HIDEBALLOONTIP = 0x1504; protected override void WndProc(ref Message m) { if (m.Msg == EM_HIDEBALLOONTIP) { System.Windows.Forms.Timer timer = (System.Windows.Forms.Timer) this.Tag; timer.Start(); } base.WndProc(ref m); } } private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); this.Refresh(); }
Does anyone have a better solution? Thanks -
fredsparkle wrote:
Does anyone have a better solution?
Well I was going to suggest something until I saw you voted down my post.
led mike
Yep, you are not the first victim of the modern voting system. Best way to avoid this (or reduce its probability) is to modify the message type away from "answer" when the only thing you (rightfully) do is ask some questions, since those questions are strictly not an "helpful answer" to the OP. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
-
Yep, you are not the first victim of the modern voting system. Best way to avoid this (or reduce its probability) is to modify the message type away from "answer" when the only thing you (rightfully) do is ask some questions, since those questions are strictly not an "helpful answer" to the OP. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
Luc Pattyn wrote:
Best way to avoid this (or reduce its probability) is to modify the message type away from "answer" when the only thing you (rightfully) do is ask some questions
Perhaps, but that doesn't stop the 'Bad Question' voting mechanism which just equates to a '1' correct? Also, the default message type isn't "Answer" anyway, it's "General Comment".
led mike
-
Luc Pattyn wrote:
Best way to avoid this (or reduce its probability) is to modify the message type away from "answer" when the only thing you (rightfully) do is ask some questions
Perhaps, but that doesn't stop the 'Bad Question' voting mechanism which just equates to a '1' correct? Also, the default message type isn't "Answer" anyway, it's "General Comment".
led mike
Hi led mike The question was did your solve my problem and sorry the answer to was no, it only gave me two choices; so thats what I clicked. :confused:
-
Luc Pattyn wrote:
Best way to avoid this (or reduce its probability) is to modify the message type away from "answer" when the only thing you (rightfully) do is ask some questions
Perhaps, but that doesn't stop the 'Bad Question' voting mechanism which just equates to a '1' correct? Also, the default message type isn't "Answer" anyway, it's "General Comment".
led mike
led mike wrote:
that doesn't stop the 'Bad Question' voting mechanism
Well, if you ask bad questions (whatever that is), then 1 is what you deserve. :-D
led mike wrote:
the default message type isn't "Answer" anyway, it's "General Comment".
I don't think so. The first-level reply to a question is an answer by default (like this one). :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
-
Hi led mike The question was did your solve my problem and sorry the answer to was no, it only gave me two choices; so thats what I clicked. :confused:
fredsparkle wrote:
The question was did your solve my problem and sorry the answer to was no, it only gave me two choices; so thats what I clicked.
proving my point exactly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
-
led mike wrote:
that doesn't stop the 'Bad Question' voting mechanism
Well, if you ask bad questions (whatever that is), then 1 is what you deserve. :-D
led mike wrote:
the default message type isn't "Answer" anyway, it's "General Comment".
I don't think so. The first-level reply to a question is an answer by default (like this one). :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
Ok got rid of the annoying flash. The problem with the timer approach is that its minimum granularity is 1/10 of a second. The final solution is to define a delegate which under the covers (way deep) does a Post Message, so the refresh operation happens after it hides everything when the ballon tip goes away. In the main custom control:
public delegate void InvokeDelegate();
tb_password.Tag = (object)new InvokeDelegate(Refresh);Our extended textbox:
public class PasswordControl : TextBox { private const int EM_HIDEBALLOONTIP = 0x1504; protected override void WndProc(ref Message m) { if (m.Msg == EM_HIDEBALLOONTIP) { Delegate del = (Delegate)this.Tag; this.BeginInvoke(del); } base.WndProc(ref m); } }
Theory of operation: 1. Create a delegate for the refresh operation for the master custom control container. 2. Assign it as a tag to the textbox that is used as a password field. 3. Extend the textbox class to monitor for the hide ballon tip messages. 4. When the extended textbox class sees that there is a closing ballon tip it instructs the master control to refresh it self via the previously created delegate. -
Hi led mike The question was did your solve my problem and sorry the answer to was no, it only gave me two choices; so thats what I clicked. :confused:
-
led mike wrote:
that doesn't stop the 'Bad Question' voting mechanism
Well, if you ask bad questions (whatever that is), then 1 is what you deserve. :-D
led mike wrote:
the default message type isn't "Answer" anyway, it's "General Comment".
I don't think so. The first-level reply to a question is an answer by default (like this one). :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
Luc Pattyn wrote:
I don't think so. The first-level reply to a question is an answer by default (like this one).
I see you are correct. Although at times the "General Comment" is the default like in this current reply. Ok I guess the default changes based on the type of the post you are replying to, I never knew that. Thanks for pointing all this out to me, although I imagine it will take me some time to start remembering to select a type, I never used to worry about it aside from occasional use of the joke type. :)
led mike