discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculator.app: entering numbers from keyboard?


From: Adam Fedor
Subject: Re: Calculator.app: entering numbers from keyboard?
Date: Sat, 18 Aug 2007 20:34:07 -0600


On Aug 16, 2007, at 10:08 PM, James Mahoney wrote:

I guess this question applies to EdenMath and Stepulator as well, but is there any way to receive input from the keyboard in Calculator.app? Otherwise, it's pretty tiresome to mouse around to enter every number and operation.


You'd need to implement/override the keyDown: method, something like this:

- (void) keyDown: (NSEvent*)theEvent
{
  NSString *characters = [theEvent characters];
  unichar  character = 0;

  if ([characters length] > 0)
    {
      character = [characters characterAtIndex: 0];

/* Figure out which character got pushed and tell that button to performClick: ... */
    }
  else
    [super keyDown: theEvent];
}

I'm not sure Calculator is organized correctly for that, though. You generally want to implement the keyDown: method in a view or in the window's delegate. But it might work OK.









reply via email to

[Prev in Thread] Current Thread [Next in Thread]