Announcement

Collapse
No announcement yet.

Input On Focus Out

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Input On Focus Out

    Hi,

    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

    Comment


    • #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: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

      Comment


      • #4
        Here even: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx


        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.

        Comment


        • #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.

          http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

          Code:
          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)
            MemoryEx.String(b,-1,MEMEX_UNICODE,s)
            User32.SendMessageA(hWnd,0x1501,0,b)
            MemoryEx.Free(b)
          end;

          Comment


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

            Comment


            • #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.

              Comment


              • #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.

                Comment


                • #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 www.dehashit.com

                  Thank you,
                  Lucrian

                  Comment


                  • #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.

                    Comment


                    • #11
                      Thank you again,

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

                      Comment

                      Working...
                      X