[Xerte] text input focus

Dave Burnett d_b_burnett at hotmail.com
Fri Aug 27 17:17:15 BST 2010



So Selection.setFocus doesn't work, but Selection.getEndIndex() and Selection.setSelection(e,e) do?
How uncool.

;-)

 



Subject: RE: [Xerte] text input focus
Date: Fri, 27 Aug 2010 16:28:19 +0100
From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk



















Dunno – what happens if you try ;-)

 

We could add another parameter to the setselection function for
caret index if you need to control it and find you can’t,

 

?

 





From:
xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk]
On Behalf Of Dave Burnett

Sent: 27 August 2010 16:27

To: Xerte list

Subject: RE: [Xerte] text input focus





 



What about these:



e = Selection.getEndIndex();

Selection.setSelection(e,e);



will they have to separately functioned as well?

Anything in the Selection class?











Subject:
RE: [Xerte] text input focus

Date: Fri, 27 Aug 2010 16:14:37 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



Not sure. On occasion some
classes – in this case Selection – don’t appear to be available to the xerte script,
or rather the interpreter is screwing with them. It’s odd because it works at
author time (which is quite an old Flash Player) and not at runtime in the
browser…

 

Anyway, we fixed it.

 





From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett

Sent: 27 August 2010 16:13

To: Xerte list

Subject: RE: [Xerte] text input focus





 



Sorry my bad.

I didn't replace all the engine swfs. Never did get a real handle on what gets
copied from where on publish.



Yes! :-)



So what's happening? Focus is somewhere weird when it's in the browser?















Subject:
RE: [Xerte] text input focus

Date: Fri, 27 Aug 2010 15:43:38 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



Right, we need an engine
function to do it. If I make this in the engine:

 

 

function setFocus(tf){

               
Selection.setFocus(tf);

}

 

I can call it and it works.
Replace your engine with this one.

 

 





From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett

Sent: 27 August 2010 15:37

To: Xerte list

Subject: RE: [Xerte] text input focus





 

Within
Xerte desktop if I test for dave = eval(Selection.getFocus());



I'm pretty much getting undefined's in browser.



Even after I manually click on a field and then use an onFocus event trigger to
trap that, checking what is focussed gives "undefined".



    





















Subject:
RE: [Xerte] text input focus

Date: Fri, 27 Aug 2010 15:27:21 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



I think so. What that was
about wsa the charPad in the template wizard, which has buttons loaded with
special characters for French, German etc.

 

What happens is the user
clicks a button and the special char gets inserted into the current text field,
and the focus is put back to the text field and IT WORKS IN THE BROWSER so it
can be solved...

 

…so looking at the code that
does that I see

 

               
Selection.setFocus(this.currentTextField);

               
Selection.setSelection(this.insertPoint + 1, this.insertPoint + 1);

 

So, not only is the selection
being put back, we also set the selection range (because we have inserted a
character, so need to know where to put the caret) 

 

But I still can’t get my
simple example to work.

 

One difference here is that
my working code is in a compiled SWF, whilst the failing code is Xerte code.

 

??

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett

Sent: 27 August 2010 15:08

To: Xerte list

Subject: RE: [Xerte] text input focus





 



Can't see how.

I just have a timer that runs when focus is lost, then drops through to set it
back.

I also removed the onFocus event trap to take that out of the equation.



Think this may have any part?

http://lists.nottingham.ac.uk/pipermail/xerte/2010-January/003835.html 



Is it maybe not getting a usable reference to the TE?

I tried putting both those paths hardcoded in, no luck.

With all the text entries in the templates, I'm gob-smacked no one has shouted.

Is there a way to do it in XOT?



















Subject:
RE: [Xerte] text input focus

Date: Fri, 27 Aug 2010 14:44:55 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



Hm. I don’t know what the
answer is then. Nothing comes readily to mind here and I can easily reproduce
it. Is the focus getting set and then stolen by something else?

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett

Sent: 27 August 2010 14:39

To: Xerte list

Subject: RE: [Xerte] text input focus





 



I've already tried stringing it, using a full path (_level0.engine.answers.txt)
strung and unstrung) same routine with a regular text input interaction, etc
etc.

Just less hair.























Subject:
RE: [Xerte] text input focus

Date: Fri, 27 Aug 2010 14:34:07 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



Years ago, in the dark ages of
the Flash Player, you would sometimes have to send a string when a movieclip
reference was required. See http://www.bigresource.com/Tracker/Track-flash-t4zJaAOAHv/

 

Where they are calling
Selection.setFocus with a string of the movieclip’s path, not a reference. Some
of the old components were foul of it as well.

 

Give that a whirl.

 





From:
xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk]
On Behalf Of Dave Burnett

Sent: 27 August 2010 14:30

To: Xerte list

Subject: RE: [Xerte] text input focus





 



Pat, the problem is with the setFocus itself.

I can't get it to work when browsered, no matter where the original focus is.



I have a couple dummy start buttons to make sure the piece has focus.

I have a 1 sec timer set up to return focus to the TE if it loses it.



This all works as expected in IDE.

In a browser, none of it works.

The event traps are saying the OnKill and OnSet are tripping, but the setFocus
does nothing.



Attached .rlo



























Subject:
RE: [Xerte] text input focus

Date: Fri, 27 Aug 2010 14:10:22 +0100

From: Patrick.Lockley at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



Could you write a function to
run onload in the flash to do a JS call to set focus?

 





From:
xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk]
On Behalf Of Dave Burnett

Sent: 27 August 2010 13:55

To: Xerte list

Subject: RE: [Xerte] text input focus





 



 

OK, in F8 in a browser trying an initial focus on load does not work because
the F object needs to be given focus first.

Add a "Start" button prior to the setFocus attempt and of course it
starts to work because the piece now has focus.

There is a bug in Flash whereby when you set focus to an empty field you get no
caret, but there is a workaround to that.



So the identical setup in Xerte does not want to work.

It is recognizing when the field is gaining or losing focus,  but
Selection.setFocus in the browser does not give the textfield focus i.e. typing
does not appear.



:-/































Subject:
RE: [Xerte] text input focus

Date: Thu, 26 Aug 2010 19:42:40 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk





Tried taking Xerte out of the
picture and built a simple flash piece?





 





At least that will tell us whether the
problem is on our side of things or not...







 































From:
xerte-bounces at lists.nottingham.ac.uk on behalf of Dave Burnett

Sent: Thu 26/08/2010 19:31

To: Xerte list

Subject: RE: [Xerte] text input focus





That
it doesn't work in a browser?



I stripped it down to bare bones, no embedded fonts, nothing but a script
created text field and a few event catchers.

Works fine in authoring mode, no go in browser.































Subject:
RE: [Xerte] text input focus

Date: Thu, 26 Aug 2010 13:14:24 +0100

From: Julian.Tenney at nottingham.ac.uk

To: xerte at lists.nottingham.ac.uk



If you’re trying to set the
focus to the textfield, the movie will get the focus anyway.

 

What
does a simple example tell us?







This message and any attachment are intended solely for the addressee and may
contain confidential information. If you have received this message in error,
please send it back to me, and immediately delete it. Please do not use, copy
or disclose the information contained in this message or in any attachment. Any
views or opinions expressed by the author of this email do not necessarily
reflect the views of the University of Nottingham. 

This message has been checked for viruses but the contents of an attachment may
still contain software viruses which could damage your computer system: you are
advised to perform your own checks. Email communications with the University of
Nottingham may be monitored as permitted by UK legislation. 



_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any
attachment are intended solely for the addressee and may contain confidential
information. If you have received this message in error, please send it back to
me, and immediately delete it. Please do not use, copy or disclose the information
contained in this message or in any attachment. Any views or opinions expressed
by the author of this email do not necessarily reflect the views of the
University of Nottingham. This message has been checked for viruses but the
contents of an attachment may still contain software viruses which could damage
your computer system: you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as permitted
by UK legislation. 





_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any
attachment are intended solely for the addressee and may contain confidential
information. If you have received this message in error, please send it back to
me, and immediately delete it. Please do not use, copy or disclose the
information contained in this message or in any attachment. Any views or
opinions expressed by the author of this email do not necessarily reflect the
views of the University of Nottingham. This message has been checked for
viruses but the contents of an attachment may still contain software viruses
which could damage your computer system: you are advised to perform your own
checks. Email communications with the University of Nottingham may be monitored
as permitted by UK legislation. 





_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any
attachment are intended solely for the addressee and may contain confidential
information. If you have received this message in error, please send it back to
me, and immediately delete it. Please do not use, copy or disclose the
information contained in this message or in any attachment. Any views or
opinions expressed by the author of this email do not necessarily reflect the
views of the University of Nottingham. This message has been checked for
viruses but the contents of an attachment may still contain software viruses
which could damage your computer system: you are advised to perform your own
checks. Email communications with the University of Nottingham may be monitored
as permitted by UK legislation. 





_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any
attachment are intended solely for the addressee and may contain confidential
information. If you have received this message in error, please send it back to
me, and immediately delete it. Please do not use, copy or disclose the
information contained in this message or in any attachment. Any views or
opinions expressed by the author of this email do not necessarily reflect the views
of the University of Nottingham. This message has been checked for viruses but
the contents of an attachment may still contain software viruses which could
damage your computer system: you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as permitted
by UK legislation. 





_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any attachment
are intended solely for the addressee and may contain confidential information.
If you have received this message in error, please send it back to me, and
immediately delete it. Please do not use, copy or disclose the information
contained in this message or in any attachment. Any views or opinions expressed
by the author of this email do not necessarily reflect the views of the
University of Nottingham. This message has been checked for viruses but the
contents of an attachment may still contain software viruses which could damage
your computer system: you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as permitted
by UK legislation. 





_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any
attachment are intended solely for the addressee and may contain confidential
information. If you have received this message in error, please send it back to
me, and immediately delete it. Please do not use, copy or disclose the
information contained in this message or in any attachment. Any views or
opinions expressed by the author of this email do not necessarily reflect the
views of the University of Nottingham. This message has been checked for
viruses but the contents of an attachment may still contain software viruses
which could damage your computer system: you are advised to perform your own
checks. Email communications with the University of Nottingham may be monitored
as permitted by UK legislation. 





_______________________________________________ Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any
attachment are intended solely for the addressee and may contain confidential
information. If you have received this message in error, please send it back to
me, and immediately delete it. Please do not use, copy or disclose the
information contained in this message or in any attachment. Any views or
opinions expressed by the author of this email do not necessarily reflect the
views of the University of Nottingham. This message has been checked for
viruses but the contents of an attachment may still contain software viruses
which could damage your computer system: you are advised to perform your own
checks. Email communications with the University of Nottingham may be monitored
as permitted by UK legislation. 







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

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20100827/79227105/attachment.html


More information about the Xerte mailing list