Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How do you set 'Space Bar' as key equiv on an NSButton?

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  Cannot format cells containing numbers  
Author Message
Jim

External


Since: Apr 05, 2006
Posts: 117



(Msg. 1) Posted: Tue Mar 17, 2009 7:20 am
Post subject: How do you set 'Space Bar' as key equiv on an NSButton?
Archived from groups: comp>sys>mac>programmer>help (more info?)

I've got a very small app that I'm just using to test stuff, and I'm seeing
something I don't fully understand.

The app is very, very simple: One window, containing a standard NSButton and
a standard label. When the button is clicked it sets the label to 'Hi
there'.

It works fine when I use the mouse to click the button.

However, I'd like it to also happen with I press the space bar. In Interface
Builder I've highlighted the button, clicked on 'Key Equiv' and hit the
space bar. A tiny square 'u' appears. I save the IB data, run the app
and...space doesn't click the button.

When I set it for something else (Enter, the letter 'g' etc) it works as
expected, just not with space.

What am I missing? It's not overly important, just one of those wee things
that puzzles me.

This is on the latest XCode and IB.

Thanks.

Jim
--
http://www.ursaMinorBeta.co.uk http://twitter.com/GreyAreaUK
Please help save Bletchley Park - sign the petition for
Government funding at: (open to UK residents and ex.pats)
http://petitions.number10.gov.uk/BletchleyPark/ Thank you.
Back to top
Login to vote
Jim

External


Since: Apr 05, 2006
Posts: 117



(Msg. 2) Posted: Tue Mar 17, 2009 7:20 am
Post subject: Re: How do you set 'Space Bar' as key equiv on an NSButton? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2009-03-17, Jim <jim.RemoveThis@magrathea.plus.com> wrote:

<snip>

Never mind, got it: defined another IBOutlet to the button itself, then
called 'setKeyEquivalent:@" "'. For some reason doing it that way works.


Learn something new every day...

Jim
--
http://www.ursaMinorBeta.co.uk http://twitter.com/GreyAreaUK
Please help save Bletchley Park - sign the petition for
Government funding at: (open to UK residents and ex.pats)
http://petitions.number10.gov.uk/BletchleyPark/ Thank you.
Back to top
Login to vote
Display posts from previous:   
Related Topics:
becomeFirstResponder and key equiv. for OK button - The action for the OK button check if the editable NSTextField hold valid date. For error the faulty NSTextField is set...

Glowing NSButton ? - Hello NG, is there a simple way to make a aqua-button glowing/pulsing ? Thank you for your time and help. Florian

setToolTip and NSMatrix of NSButton - What is wrong with this code: matrix_of_but is a NSMatrix of NSButton NSButton *but; but = [matrix_of_but..

[Q] New grid style of NSButton? - I remember reading something recently about a new visual style for a tightly packed array or grid of NSBttons, similar...

Novice question about NSButton - Hello, I have been working my way through developing my first Cocoa app, (a calculator, naturally) and have hit a bit....

Cocoa: Problem with NSButton class - Hello, In one of my projects I have a NSOpenGLView and a NSScrollView in the same window. In the scroll view I have lot...
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]