[Xerte] Inserting Special Characters

Julian Tenney Julian.Tenney at nottingham.ac.uk
Fri Jan 8 16:06:02 GMT 2010


Take a wild guess what Selection.getFocus(); returns?

 

The textField?

 

Nope - a String. Cosmic.

 

You need

 

this.currentTF = eval(Selection.getFocus());

 

to actually get the textField.

 

 

 

From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: Friday, January 08, 2010 3:53 PM
To: Xerte discussion list
Subject: RE: [Xerte] Inserting Special Characters

 

Exactly my thinking:

 

INTERFACE.prototype.trackTextFields = function(){

                

                this.onSetFocus = function(){

                                

                                delete this.currentTF.onChanged;

 

                                this.currentTF = Selection.getFocus();

                                

                                debug("got " + this.currentTF);

                                

                                this.currentTF.onChanged = function(tf){

                                                debug("CHANGED");

                                }

                }

                Selection.addListener(this);

}

 

So I enable it by calling rootIcon.trackTextFields; I see the debug as
the focus changes, but I am not seeing the change handler fire - WTF? I
need to know the current TF AND the position of the caret, so that when
I click my special char insert button, I know where to put it.

 

 

From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: Friday, January 08, 2010 3:51 PM
To: Xerte list
Subject: RE: [Xerte] Inserting Special Characters

 

Maybe a global func that holds the tf id of the last tf with focus?

<pseudo>
if object with focus=TF {
last_active = TF ID
}
</pseudo>


> Date: Fri, 8 Jan 2010 15:27:12 +0000
> From: Julian.Tenney at nottingham.ac.uk
> To: xerte at lists.nottingham.ac.uk
> Subject: [Xerte] Inserting Special Characters
> 
> I want to have anumber of buttons insert special characters into a
> textfield. How can I get the textfield that is currently selected when
I
> click a button?
> 
> If I debug (Selection.getFocus()) after clicking the button, I get -
of
> course - the button, as I just selected it by clicking it. How can I
> know the textField that has / did have the caret in it, and the
position
> of the caret?
> 
> Previously I've done this by having the textfield update some
variables
> onChange, but this isn't an option in this case.
> 
> J
> _______________________________________________
> Xerte mailing list
> Xerte at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte

________________________________

Hotmail: Trusted email with Microsoft's powerful SPAM protection. Sign
up now. <http://clk.atdmt.com/GBL/go/196390706/direct/01/> 

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


More information about the Xerte mailing list