No announcement yet.

Input On Focus Out

  • Filter
  • Time
  • Show
Clear All
new posts

  • Input On Focus Out


    Because Input don't have "On Focus Out", it is any alternative to use it?

    My case:
    I populate my input with a text "sample".
    When user click on input, it become blank.
    I want that if the input remain blank and user go to another input, to write back "sample" in that input.

    Using "On key" and "On char" is buggy because don't cover all situations and if you delete everything will appear "sample" and when you press "a" (or any KEY), you'll get "asample" (or "KEYsample").

    There is any alternative?

    Thank you!

  • #2
    you can used Hotspot Object Plugin


    • #3
      Input is just an edit control, you can subclass it with MemoryEx then catch all events or even add missing functionality like balloons and cue text.

      Kill focus:


      • #4
        Here even:

        You know forum admins people contribute even if using the free version so why not give them a bit of grace time to edit mistakes in posts, you know its the sociable thing to do.


        • #5
          Using the cue text does exactly what you want but it's from Vista onwards so you'll need something else for XP if you support it even though Microsoft dont.

          Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information.

          User32 = Library.Load("user32.dll");
          SetCue = function(hWnd,Txt) -- hWnd = handle to input object, Txt = the text to set.
            local s = Txt or ""
            local n = String.Length(s) + 1
            local b = MemoryEx.Allocate(n *2)


          • #6
            It does work on xp sorry, its the balloon tips that dont so you'll not need to do any sub-classing.


            • #7
              Thanks for answers!

              aboad, it seems that don't work with hotspot object.

              Shrek, you probably made a very nice job, but is too advanced for me. I didn't understand what should I do and where should I put that code.
              I will not offer support for win xp. I want to create a free app, so support will be at minimum level, but the application should work fine.


              • #8
                Its not hard its just one function, think I made it hard with the posts but thats because editing is banned for those that dont buy the commercial edition.

                Input Cue Text.apz

                This works on Vista onwards, the function itself is supposed to work on XP but on my copy I have Asian languages installed so that might be why it does not work on xp but maybe not.


                • #9
                  Shrek, you're awesome!
                  I'm looking at your code and I don't understand that code. Probably because I understand only the native AMS with no link to Windows, like "User32.SendMessageA(hWnd,0x1501,0,b)"
                  Things like 0x1501 ... are not for me (yet)
                  Your code works perfectly after I've installed MemoryEx.

                  I've already publish the application at

                  Thank you,


                  • #10
                    EM_SETCUEBANNER = 0x1501

                    So all your doing is sending a message to the input control telling it that its going to be setting cue text and giving it the address to the buffer containing the Unicode string, b in the function.


                    • #11
                      Thank you again,

                      Probably I will add balloons too, in next version. Just for learning.