Announcement

Collapse
No announcement yet.

firefly blur() event

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

  • firefly blur() event

    In firefly, how can I trap when a control (text box) looses focus?

  • #2
    Look into WM_SETFOCUS/WM_KILLFOCUS messages. And, if any messages don't exist in the dropdown you can always add it in the CUSTOM message handler. One tool I use all the time is WinSpector to spy on a window or control and see what messages get sent, so I know what to trap and where to trap it (At form level or at control level).

    Added:
    Actually, in looking, it looks like in the edit controls it is sent as EN_Set/KillFocus messages too which FireFly uses in the dropdown, but either will work.
    Last edited by Roger Garstang; 20 Aug 2009, 04:11 PM.
    sigpic
    Mobile Solutions
    Sys Analyst and Development

    Comment


    • #3
      killFocus is the ticket, thanks

      Comment


      • #4
        Now I see that killFocus is called everytime anything happens, like click on another control.

        How can I just call a function when that text box looses focus?

        Comment


        • #5
          Hi Shawn,

          How are you testing for the KillFocus?

          Code:
          '--------------------------------------------------------------------------------
          Function FORM1_TEXT1_EN_KILLFOCUS ( _
                                            ControlIndex   As Long,  _  ' index in Control Array
                                            hWndForm       As Dword, _  ' handle of Form
                                            hWndControl    As Dword, _  ' handle of Control
                                            idTextControl  As Long   _  ' identifier of text control
                                            ) As Long
              
              zTrace "Text1 Killfocus"
              
          End Function
          Paul Squires
          FireFly Visual Designer (for PowerBASIC Windows 10+)
          Version 3 now available.
          http://www.planetsquires.com

          Comment


          • #6
            like this

            Code:
            Function OUTGOING_CONSIGNEDTO_EN_KILLFOCUS ( _
                                                       ControlIndex   As Long,  _  ' index in Control Array
                                                       hWndForm       As Dword, _  ' handle of Form
                                                       hWndControl    As Dword, _  ' handle of Control
                                                       idTextControl  As Long   _  ' identifier of text control
                                                       ) As Long
                                                       
            	MsgBox "test blur"                                           
            
            End Function

            Comment


            • #7
              Originally posted by Shawn Anderson View Post
              Now I see that killFocus is called everytime anything happens, like click on another control.

              How can I just call a function when that text box looses focus?
              Hi Shawn,

              That does make sense that KillFocus will fire whenever the text box looses focus. If you click on another control then obviously the text box no longer has control so it will fire the KillFocus. Maybe you can send me the project or a sample that exhibits the problem and I'll be sure to give you a more specific reasoning for the behavior you're experiencing.
              Paul Squires
              FireFly Visual Designer (for PowerBASIC Windows 10+)
              Version 3 now available.
              http://www.planetsquires.com

              Comment


              • #8
                I will send you an example, thanks.

                It is not only "firing" when expected (when that control looses focus) but when any control looses focus.

                Comment


                • #9
                  Hi Shawn,

                  The problem is the MsgBox stealing focus during the KillFocus of the Text Box. I am sending you a private email based on the project that you sent me.
                  Paul Squires
                  FireFly Visual Designer (for PowerBASIC Windows 10+)
                  Version 3 now available.
                  http://www.planetsquires.com

                  Comment


                  • #10
                    The dreaded msgbox issues. I use them a lot for troubleshooting, but you do have to remember focus issues. Also for people that wrongly process keys on KeyUp (KeyDown is better and gives you repeat functionality)...msgbox doesn't eat the KeyUp and it gets sent to your control/form too.
                    sigpic
                    Mobile Solutions
                    Sys Analyst and Development

                    Comment

                    Working...
                    X