Challenging text editing field problem

  • My interface has a tricky issue when text is edited to a previously
    empty field (due to way the new text changes the data which then
    changes the layout of the window). I am having trouble following all
    the events to make sure handle things in the correct order. The
    current issue being sure the user does not add more data until the
    application is ready for it. There are several issues but here is the
    first:

    I have subclassed NSTextField to override some methods including
    becomeFirstResponder and resignFirstResponder. I was hoping to make
    use of resignFirstResponder, but when my window opens, the first
    editing fields gets the following messages:

    1. [theField becomeFirstResponder]
    2. [theField resignFirstResponder]

    and then when the window is open, that field is still the first
    responder. I can understand getting the becomeFirstResponder message,
    but why does it get a resignFirstResponder message while it is still
    the first responder?

    When I tab to next field, I get

    1. [nextField becomeFirstResponder]
    2. [nextField resignFirstResponder]

    but I was expecting

    1. [theField resignFirstResponder]
    2. [nextField becomeFirstResponder]

    My only thought is that when a text field becomes the first responder,
    it immediately gives it up to the field editor?

    ---------------
    John Nairn (1-541-737-4265, FAX:1-541-737-3385)
    Professor and Richardson Chair
    Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
    FEA/MPM Web Page: http://oregonstate.edu/~nairnj