Re: using KEBOARD into a EditBox with InputMask
From: Robert (roberth.nospam_at_software-intellect.com.nospam)
Date: 07/28/04
- Next message: Gerben Kessen: "Re: Programs"
- Previous message: Cindy Winegarden: "Re: User ID File"
- In reply to: AndyV: "Re: using KEBOARD into a EditBox with InputMask"
- Next in thread: Gene Wirchenko: "Re: using KEBOARD into a EditBox with InputMask"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Jul 2004 13:00:32 -0400
Testing with your code, may I make the following observations:
The selStart property is relative to 0; thus initialize
thisform.currentposition to 0.
When processing procedure pokekey, you do a thisform.txtentry.setfocus and
keyboard command, these command execute before the txtentry gets focus,
thus nothing has changed yet with the txtentry properties. Once txtentry
gets focus, and consumes the keyboard command, to capture the changes, put
your code in the txtentry.keypress procedure (note: this procedure has
parameters, so do not forget a dodefault(nKeyCode, nShiftAltCtrl) command).
You really do not need the thisform.currentposition property nor
thisform.dataentered, as these are part of the txtentry properties selstart
and value.
You may also need code in the txtentry.keypress procedure to intercept the
backspace command to handle this correctly.
--
Robert Hoogstraat
Software Intellect
"AndyV" <a@a> wrote in message news:4107cc29_4@newsfeed.slurp.net...
> Un-natural in the sense that it is very difficult to get the exact
contents of
> the EditBox's ControlSource variable and Value properties while the code
is
> running because the 'focus' keeps getting set back to the Debug window
when
> stepping thru the code.
>
> Basically, I have a form (was Modal, but tried it Modeless just to see...)
with
> an EditBox and a set of buttons corresponding to a QWERTY keyboard. In
the
> Click event of these buttons, there is a call to a procedure called
PokeKey,
> like this:
>
> THISFORM.PokeKey('Q')
>
> The form's PokeKey procedure is where I'm attempting to set focus to the
EditBox
> and KEYBOARD in the value passed in, thusly:
>
> PROCEDURE PokeKey
> PARAMETERS cKeyPoked
>
> * to see current 'before' status of vars:
> THISFORM.Caption = ;
> 'DE<'+THISFORM.DataEntered+'>=NDE<'+THISFORM.NewDataEntered+'> ;
> tE.V('+THISFORM.txtEntry.Value+') CP#'+STR(THISFORM.CurrentPosition)
>
> THISFORM.txtEntry.SelStart = THISFORM.CurrentPosition && initialized to 1
> THISFORM.txtEntry.SetFocus
>
> KEYBOARD cKeyPoked
>
> THISFORM.CurrentPosition = LEN(ALLTRIM(THISFORM.DataEntered))
>
> * to see current 'after' status of vars:
> THISFORM.Label1.Caption = ;
> '<'+THISFORM.DataEntered+'>=<'+THISFORM.NewDataEntered+'> ;
> ('+THISFORM.txtEntry.Value+') #'+STR(THISFORM.CurrentPosition)
>
> THISFORM.REFRESH
>
> <EndOfProcedure>
>
> I was attempting to use another custom form property, NewDataEntered to
compare,
> but during my slash and burn operation, I have removed the usage of it,
because
> that strategy wasn't working.
>
> The Init procedure optionally passes in an InputMask to the
txtEntry.InputMask
> property, and sets the txtEntry.Format='R'. I tried it without setting the
> Format value.
>
> The <BackSpace> button's Click Event: THISFORM.PokeKey('{BACKSPACE}')
>
> Neither of the 'to see' captions reflect the 'current' contents of the
txtEntry
> EditBox or it's SelStart value.
>
> Andy.
>
>
> Robert wrote:
>
> > " un-natural stuff " - explain? Can you post relevant code snippet (ie.
> > where you do the stuffing, what you do for the editbox, etc.)?
> >
> > --
> > Robert Hoogstraat
> > Software Intellect
> > "AndyV" <a@a> wrote in message news:4107bedf$1_2@newsfeed.slurp.net...
> >
> >>I tried, but it seems like there is some un-natural stuff going on when
> >
> > the
> >
> >>form/EditBox looses focus to go to the Debugger window.
> >>
> >>Andy.
> >>
> >>Robert wrote:
> >>
> >>
> >>>Have you followed the event firing sequence through the debugger while
> >
> > you
> >
> >>>are stuffing the character?
> >>>
> >>>--
> >>>Robert
> >>>
> >>>"AndyV" <a@a> wrote in message news:4107b7f7$1_4@newsfeed.slurp.net...
> >>>
> >>>
> >>>>Robert,
> >>>>I left it in. The main problem I'm having is finding at what point
the
> >>>
> >>>contents
> >>>
> >>>
> >>>>of the TextBox.Value and/or TextBox.ControlSource value is stable. In
> >
> > the
> >
> >>>>form's procedure that does the actual stuffing of a newly-entered
> >>>
> >>>character with
> >>>
> >>>
> >>>>the KEYBOARD cCharToInput command, neither of the values reflect what
is
> >>>>displayed on the form until the form returns to it's 'waiting for
input'
> >>>
> >>>state.
> >>>
> >>>
> >>>> Once I find a place in the order-of-events, I can compare the actual
> >>>
> >>>value of
> >>>
> >>>
> >>>>the ControlSource with the intended value, after the InputMask could
> >>>
> >>>possibly
> >>>
> >>>
> >>>>reject a character, and set the SelStart value to the length of the
> >
> > actual
> >
> >>>>results' length.
> >>>>
> >>>>Thanks for your views.
> >>>>Andy.
> >>>>
> >>>>
> >>>>Robert wrote:
> >>>>
> >>>>
> >>>>
> >>>>>Did you remove or leave in the "TextBox.SelStart =
> >
> > nLastCursorPosition"
> >
> >>>>>command?
> >>>>>
> >>>>>--
> >>>>>Robert Hoogstraat
> >>>>>Software Intellect
> >>>>>"AndyV" <a@a> wrote in message
news:4106d5eb$1_2@newsfeed.slurp.net...
> >>>>>
> >>>>>
> >>>>>
> >>>>>>The SelectOnEntry property was set to .F., but when I changed it to
> >
> > ..T.
> >
> >>>it
> >>>
> >>>
> >>>>>>didn't seem to have much effect, except that the entire size of the
> >>>>>
> >>>>>InputMask is
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Marked initially, but not after the first key is 'poked'. I'm at
the
> >>>>>
> >>>>>burnout
> >>>>>
> >>>>>
> >>>>>
> >>>>>>stage of this 'tiny' enhancement and I think I need to re-boot my
> >>>
> >>>attitude
> >>>
> >>>
> >>>>>and
> >>>>>
> >>>>>
> >>>>>
> >>>>>>re-think the whole thing.
> >>>>>>
> >>>>>>Thanks for looking into this.
> >>>>>>
> >>>>>>Andy.
> >>>>>>
> >>>>>>Robert wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>What is the value of textbox.selectonentry property? For me, on a
> >
> > test
> >
> >>>>>>>form, setting selectonentry to .t. gives the result you describe;
> >>>>>
> >>>>>setting
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>selectonentry to .f. gives the result you are after.
> >>>>>>>--
> >>>>>>>Robert Hoogstraat
> >>>>>>>Software Intellect
> >>>>>>>
> >>>>>>>"AndyV" <a@a> wrote in message
> >
> > news:4106b7ae$1_4@newsfeed.slurp.net...
> >
> >>>>>>>
> >>>>>>>
> >>>>>>>>I'm trying to enhance my TouchScreen Entry form by allowing an
> >>>
> >>>InputMask
> >>>
> >>>
> >>>>>>>on the
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>data entered. Basically, my customer would like to be able to do
> >>>
> >>>simple
> >>>
> >>>
> >>>>>>>input
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>masking (like A9A-9A9 for Canada Postal Codes) in order to make it
a
> >>>>>>>
> >>>>>>>little more
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>difficult for the entry operators to screw up. That is a trivial
> >>>>>>>
> >>>>>>>operation when
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>entering with a keyboard, but when entering data with my
TouchScreen
> >>>>>
> >>>>>Entry
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>form
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>is where I'm running into difficulties.
> >>>>>>>>
> >>>>>>>>Basically, I have a Form with a button for each letter (laid out
> >
> > like
> >
> >>>a
> >>>
> >>>
> >>>>>>>QWERTY
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>keyboard) that enters the 'keys' touched into a TextBox. I
thought
> >>>
> >>>that
> >>>
> >>>
> >>>>>>>it
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>would be a simple matter of Setting Focus to the TextBox (with an
> >>>>>>>
> >>>>>>>InputMask),
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>then passing the keystroke with a "KEYBOARD cKeyPassedIn" command.
> >>>>>>>>Unfortunately, the cursor is always on the first position, so it
> >>>>>
> >>>>>'inserts'
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>the
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>newly-entered character in the first position. I tried to
manually
> >>>>>>>
> >>>>>>>attempt to
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>keep track of where the last character is and force the cursor to
> >
> > that
> >
> >>>>>>>position
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>with a "TextBox.SelStart = nLastCursorPosition" command. I
managed
> >
> > to
> >
> >>>>>get
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>most
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>of it working, but when attempting to backspace to correct an
> >>>
> >>>incorrect
> >>>
> >>>
> >>>>>>>entry, I
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>ran into the problem of keeping an accurate nLastCursorPosition,
> >>>
> >>>because
> >>>
> >>>
> >>>>>a
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>cKeyPassedIn could be quietly rejected because it isn't a valid
> >>>>>
> >>>>>InputMask
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>data-type. I tried to sense this by capturing the
> >>>>>>>
> >>>>>>>BeforeValue+cKeyPassedIn to
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>the TextBox.ControlSource variable. During the general Method
that
> >>>
> >>>does
> >>>
> >>>
> >>>>>>>this
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>'simple' KEYBOARD operation, I haven't been able to get an
accurate
> >>>>>>>>TextBox.Value or value of the TextBox.ControlSource. They both
seem
> >>>
> >>>to
> >>>
> >>>
> >>>>>be
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>either empty, or what was there BEFORE the current operation.
> >>>>>>>>
> >>>>>>>>Is there a better way to do this? More specifically, is there a
way
> >>>>>
> >>>>>that
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>will work?
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Thanks for reading this far,
> >>>>>>>>Andy.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>
> >
> >
- Next message: Gerben Kessen: "Re: Programs"
- Previous message: Cindy Winegarden: "Re: User ID File"
- In reply to: AndyV: "Re: using KEBOARD into a EditBox with InputMask"
- Next in thread: Gene Wirchenko: "Re: using KEBOARD into a EditBox with InputMask"
- Messages sorted by: [ date ] [ thread ]