On 27/6/06 11:37, kee nethery wrote:
If I type data into a field, when I leave the field it gets a closefield message and I have a handler for that.

When I paste text into a field and leave the field without typing anything, the field does not get a closefield message and my handler never gets called.

Watching the message watcher doesn't present any obvious solution for what to use to catch the paste into a text field. Do I have to write a handler that traps a set of keystrokes (command V) and then sends the field a closefield event?

What does everyone else do?

What I do is whinge for a while, then do something like this:

        on keyDown
          setCompDirty true
          pass keyDown
        end keyDown
        
        on returnInField
          setCompDirty true
          pass returnInField
        end returnInField
        
        on deleteKey
          setCompDirty true
          pass deleteKey
        end deleteKey
        
        on backspaceKey
          setCompDirty true
          pass backspaceKey
        end backspaceKey
        
        on cutKey
          setCompDirty true
          pass cutKey
        end cutKey
        
        on pasteKey
          setCompDirty true
          pass pasteKey
        end pasteKey
        
In this case I've got a form with a number of fields on it, so I'm not so bothered about when the user leaves the field; "setCompDirty" does things like enable Save and Revert buttons, and make sure that stuff happens when they leave the form. But if you really wanted something to happen when the field is 'exited', with a change, then I'd guess you could trap both exitField and closeField, with the former checking a flag set in some manner analogous to the above.

A while ago on the x-talks list I proposed a "fieldChanged" message, to be sent to a field the first time the text in it changes - whether by typing, deleting, cut and pasting, drag and dropping, etc - anything except purely programmatic changes. One idea was that it should be sent on every change, just saving you from remembering all the possible messages to catch (and I note that my list above, from an actual app, won't catch drag and drop changing, oops). Another idea was that it should be sent just once, and then not again until reset. We discussed 'reset' possibilities including automatic, once the field loses focus (ie, essentially, when a closeField/exitField message has been sent); or manual, ie a property of the field that could be reset to indicate that you want to know the next time it happens too... unfortunately we got bugged down in these and other discussions about how exactly this should work, and it never got bugzilla'd it... but perhaps I'll dig out the details and have another go.

HTH,

  Ben Rubinstein               |  Email: [EMAIL PROTECTED]
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to