Default button behavior

Hey Guys,

If you set the key equivalent in IB to the Return key it makes your button the default button. In order to change this by a script action, like on selection, you would set the property of the button you want to be default to the return key. The key equivalent property for the button seems to want a unicode value.

Anyone know how to set this?

Thanks in advance for any help.

Jim

i don’t have my mac here, so i can’t test this, but could you not say somthing like

set key equivilent of theObject to (return) as unicode
(maybe unicode text i don’t remember off hand)

If it doesn’t work, sorry for the bad post.

I’d make sure that if you have a button using the key already that you set it’s key equiv value to “” before connecting another button to it…otherwise it retains its connection to the first button. Anyways, this worked for me…

		set key equivalent of button "button" of window "window" to ""
		set key equivalent of button "button2" of window "window" to (ASCII character 13)

I messed with other keys (like letters) a bit and had trouble getting any keys other than the static keys in the pulldown menu to work with buttons. They work fine with menu items, but attaching a “cmd-” key to a button doesn’t work for me. Could be a bug in 10.2 that 10.3/xcode has fixed.

j