[Xerte] default button

Paul Swanson Paul.Swanson at harlandfs.com
Fri Oct 24 17:07:18 BST 2008


You can set up a key press interaction by adding an event response to
the interaction icon that contains your button. The eventName property
is onKeyDown and set the icon property to rootIcon. Then add a script
icon with something like the following:
 
keyPressed = Key.getCode();
 
if ((keyPressed == 13) || (keyPressed == 9)) { // Enter or Tab pressed

  // do whatever

}
 
The key numbers correlate to the ASCII chart of characters. A-Z is
65-90, a-z is 97-122, so for a lower-case y you would want to look for
121, capital Y should be 89. Lower-case n should be 110, and capital N
should be 78 (if I counted correctly).


________________________________

	From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Elly Langewis
	Sent: Friday, October 24, 2008 8:48 AM
	To: Xerte discussion list
	Subject: Re: [Xerte] default button
	
	
	Thanks Julian, that explains. 
	Is it possible to set the focus to a certain button? And is it
possible to make a button react to a certain key pressed, like when I
have two buttons, yes and no, and want the user to be able to press Y or
N (besides making a third response to catch that)?
	 
	Elly
	
	
	On Fri, Oct 24, 2008 at 5:03 PM, Julian Tenney
<Julian.Tenney at nottingham.ac.uk> wrote:
	

		It's built in accessibility. It will only respond to
keys whilst it has the focus. When you click elsewhere, the focus moves
away from the button and it doesn't respond to keypresses. All the
interaction responses can be controlled with the keyboard.

		 

		From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Elly Langewis
		Sent: Friday, October 24, 2008 3:41 PM
		To: Xerte discussion list
		Subject: [Xerte] default button

		 

		Hi,

		 

		I've got a perpetual button ('Menu') in my Entry Frame.
For some reason, when I have used the button (just once), this button
will also get pressed when I hit the space bar. As I have not found yet
how to let a button react to key responses I was quite surprised...

		Does anyone know what caused this behaviour? It
disappeats after using a text entry response, but after hitting the
button again it reacts to the space bar again.

		 

		TIA

		 

		Elly

		 


		_______________________________________________
		Xerte mailing list
		Xerte at lists.nottingham.ac.uk
		http://lists.nottingham.ac.uk/mailman/listinfo/xerte
		
		




	-- 
	Elly Langewis
	courseware developer
	Department of Biology
	Utrecht University
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20081024/56784d7f/attachment.html


More information about the Xerte mailing list