Re: Detecting a focus change in a window?
Re: Detecting a focus change in a window?
- Subject: Re: Detecting a focus change in a window?
- From: "Bruce Johnson" <email@hidden>
- Date: Sat, 23 Sep 2006 18:30:27 -0700
I used an NSMatrix of NSTextFields to do something similar to what you
are trying to do. My matrix has 4 text fields
pseudo-code written in mail.
in an IBAction method
//get the selected cell
int currentCell = [[myNSMatrixTextField selectedCell] tag];
float newval;
if ([sender isKindOfClass: [NSStepper class]] == YES)
{
newval = [[myNSMatrixTextField cellAtRow: 0 column: currentCell]
floatValue] + ([sender floatValue] * 0.001);
[[myNSMatrixTextField cellAtRow: 0 column: currentCell]
setFloatValue: newval];
[sender setIntValue:0];
}
my stepper has a very large min and max value, increments by one and
the values wrap.
I imagine that if you want to change the min and max values of the
stepper, you could grab the values from the matrix and update the
stepper.
On 9/23/06, Nick Zitzmann <email@hidden> wrote:
On Sep 23, 2006, at 4:39 PM, Mark Dawson wrote:
> I have an NSStepper that controlls two NSTextFields. When focus
> changes from one field to the other, I want to update the stepper
> to relect the new value. However, I can't seem to find anything
> that allows me to detect the focus change.
>
> In my NSWIndowController subclass, I added a -(BOOL)
> becomeFirstResponder. However, it is never called. Do I need to
> subclass my NSTextField views & implement becomeFirstResponder
> there? Or is there some other way?
You probably want to use the NSTextField delegate method -
controlTextDidEndEditing:.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
----
Bruce Johnson
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden