Results 1 to 4 of 4

Thread: Commit FormModel on losing focus on FormPage

  1. #1
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default Commit FormModel on losing focus on FormPage

    Is it possible to get the state of FormModel either changed or not as a whole form not by a property? I want to prompt user to save their changes if they move away from FormPage and FormModel has been changed.

    Amad

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    You'll need to do something like this:

    Code:
    void onFocusLost() {
      if (formModel.isDirty()) {
         // prompt user to save
      }
    }
    Ollie

  3. #3
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default

    Thanks Ollie . Now If I can only make JPanel to work with FocusListener... For some reason or bug JPanel never gets focusGained or focusLost events.

    But thanks for your help, any ideas about my other post on CreateCompoundChild

    Thanks

    Amad

  4. #4
    Join Date
    Sep 2004
    Location
    Ghent, Belgium
    Posts
    224

    Default

    A JPanel never receives focus (it's not focusable), so it never receives focusLost or focusGained events.

Similar Threads

  1. Replies: 8
    Last Post: Aug 24th, 2005, 01:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •