// (Globals.)
int fieldActive=NONE ;
NSTimer *theTimer ;
// Start the repeating timer. (This code should be executed only
// once, when the app first starts up.)
theTimer=[NSTimer scheduledTimerWithTimeInterval:.1 target:self
selector:@selector(handleTimerPulse:) userInfo:nil repeats:YES];
- (void) handleTimerPulse:(id) timer {
// Handle textfield focus changes.
if (fieldActive!=FIELD_A && hasFocus(fieldA)) {
fieldActive =FIELD_A;
do something in reaction to field A getting focus; }
if (fieldActive!=FIELD_B && hasFocus(fieldB)) {
fieldActive =FIELD_B;
do something in reaction to field B getting focus; }}
|