Re: Moving the Cursor

new topic     » goto parent     » topic index » view thread      » older message » newer message

I don't find it that much of a problem... there is an example of such on the 
internet banking website I use all the time:

You have to type in a 16 digit card number - it adds a dash every 4 letters, 
and when you get to the 16th digit it skips to the next field for you.

However if you don't want that, then just use an onLostFocus hook.

procedure onLostFocus(blah)
    j = getText(blah)
    j = fixNumber(j)
    putText(blah)
end procedure

blah

=====================================================
Head too fuzzy to type more detail
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__| Mr Trick

>From: Derek Parnell <ddparnell at bigpond.com>
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: Re: Moving the Cursor
>Date: Mon, 12 Aug 2002 15:13:58 +1000
>
>
>Hi Jon,
>from many years experience, I discovered it is never a good idea to try and
>format a telephone number as the user is typing it in. It is much easier,
>and user-friendlier, to allow the user to enter anything that they feel
>like. Then, if you really feel that it has to "look" right, you parse it 
>and
>format it AFTER they have entered something. This just as easy and seems to
>keep everybody a bit happier. MOst telephone numbers that are ever entered
>in are only used to SHOW people what the number is. Nearly everybody can
>decipher a telephone number from what somebody else has typed in. The main
>use is to dial a modem - but as that only uses numbers, it is easy enough 
>to
>just strip out the non-digits at dialing time.
>
>---------------
>Derek.
>
>----- Original Message -----
>From: "Jon Snyder" <jongsnyder at hotmail.com>
>To: "EUforum" <EUforum at topica.com>
>Sent: Monday, August 12, 2002 2:06 PM
>Subject: RE: Moving the Cursor
>
>
> > Dan,
> >
> > Thanks. That's a good idea, but I think that there has to be a better
> > way.
> >
> > The main reason that i didn't want to have different text boxes was to
> > allow the flexibility of using a default area code or just entering 10
> > digits into the edit box.  If you noticed my "addDashes()" routine
> > formated a 7 digit number like this, 123-4567, and a 10 digit number
> > like this, 123-456-7890.  If just 7 digits were entered it would use the
> > default area code as the area code.  I realize you could do this with
> > multiple edit boxes, but i think that would be more mess than its worth.
> >
> > There had to be some c routine that would be able to move the cursor to
> > the end of an edit box.  Would it be that hard just to link to some c
> > routine that would do this?
> >
> > I also thought of the possiblity of just fooling the key handler into
> > thinking that the "End" button was pressed.  I don't know how to even
> > start doing something like that.
> >
> > --Jon Snyder
> >
> > Dan Moyer wrote:
> > > Jon,
> > >
> > > Here's an attempt to be helpful; it does *some* of what you want, but
> > > not
> > > exactly always, maybe it could be fixed up, or at least prompt a 
>better
> > > attempt?
> > >
> > > It uses the "3" edit boxes you *didn't* like, backspaces correctly
> > > *some* of
> > > the time to the *end* of the previous number field (& *doesn't* other
> > > times,
> > > moves to *beginning* of previous instead), & moves from the prefix to
> > > the
> > > last part of the number on filling in 3 digits.  I didn't put the "-"
> > > between the boxes, nor make the area code move to prefix after filling
> > > in 3
> > > there.  It also uses the "unlink the handler" idea that Don Phillips
> > > suggested, though I had to use a "dummy" procedure to do it right, "0"
> > > didn't work for me.
> > >
> > > You could argue that it doesn't actually force positioning of the
> > > cursor, &
> > > you'd be right.  :(   This simple problem seems harder (to me) than it
> > > sounds!  Maybe there's a simpler solution we're overlooking?
> > >
> > >
> > > Dan Moyer
> > >
> > >
>--
> > >
> > > -----------
> > > include Win32Lib.ew
> > > without warning
> > >
> >
>--
> > >
> > > ----
> > > constant Window1 = create( Window, "Window1", 0, Default, Default, 
>400,
> > > 300,
> > > 0 )
> > > constant Prefix  = create( EditText, "", Window1, 52, 56, 30, 28, 0 )
<snip>

> > >
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu