Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Caps Lock Problem with DDX_ManagedControl

Caps Lock Problem with DDX_ManagedControl

Scheduled Pinned Locked Moved Managed C++/CLI
helpcsharpc++comhosting
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F fredsparkle

    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!

    L Offline
    L Offline
    led mike
    wrote on last edited by
    #2

    What sort of things have you tried so far?

    led mike

    F 1 Reply Last reply
    0
    • L led mike

      What sort of things have you tried so far?

      led mike

      F Offline
      F Offline
      fredsparkle
      wrote on last edited by
      #3

      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

      L 1 Reply Last reply
      0
      • F fredsparkle

        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

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #4

        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

        L 1 Reply Last reply
        0
        • L led mike

          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

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #5

          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:


          L 1 Reply Last reply
          0
          • L Luc Pattyn

            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:


            L Offline
            L Offline
            led mike
            wrote on last edited by
            #6

            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

            F L 2 Replies Last reply
            0
            • L 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

              F Offline
              F Offline
              fredsparkle
              wrote on last edited by
              #7

              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:

              L L 2 Replies Last reply
              0
              • L 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

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #8

                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:


                F L 2 Replies Last reply
                0
                • F fredsparkle

                  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:

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #9

                  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:


                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    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:


                    F Offline
                    F Offline
                    fredsparkle
                    wrote on last edited by
                    #10

                    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.

                    1 Reply Last reply
                    0
                    • F fredsparkle

                      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:

                      L Offline
                      L Offline
                      led mike
                      wrote on last edited by
                      #11

                      Thanks fred. May I suggest that until everyone gets the hang of this new voting mechanism you only vote Yes otherwise don't vote at all.

                      led mike

                      1 Reply Last reply
                      0
                      • L Luc Pattyn

                        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:


                        L Offline
                        L Offline
                        led mike
                        wrote on last edited by
                        #12

                        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

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups