I need to be able to find the current value of a NSTextField even if it is 
being edited. I have the following code to check if it is being edited, and get 
the value from the field editor instead:

        fresp = [[txtf window] firstResponder];
        if ([fresp isKindOfClass:[NSTextView class]] && [(NSTextView*)fresp 
delegate] == txtf)
            str = [(NSTextView*)fresp string];                // being edited, 
get from field editor
        else
            str = [txtf stringValue];            // not being edited, get from 
textfield itself

When the text field (txtf) is being edited, the first case is definitely used, 
but the wrong value still results. Ie suppose the original textfield contained 
100, I click on it to edit it and change the value to 140. Now the code above 
runs (while the text field is still being edited). The result is the original 
100, not the current 140, even though it is the field editor that is being 
queried. 

How do I get the correct current value? This is a generic query, it can't end 
editing on the field or otherwise change the state. Needless to say, I'm more 
than a little surprised by this behavior. The whole field editor thing is kind 
of like hanging your underwear to dry in the living room to start with. Now the 
actual state seems to be even more opaque.

Thanks.



      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to