Hello,
Try this...
in the event loop
switch (eventP->eType)
{
FieldPtr fieldPtr;
case keyDownEvent:
if (((eventP->data.keyDown.chr >= '0')
&& (eventP->data.keyDown.chr <= '9'))
|| (eventP->data.keyDown.chr == ',')
|| (eventP->data.keyDown.chr == '.'))
{
fieldP = GetFocusObjectPtr(); //gets field with the focus
appendCharToField (fieldP, eventP->data.keyDown.chr);
}
handled = true;
break;
> De: Andy Black <[EMAIL PROTECTED]>
> Responder a: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Grupos: palm-dev-forum
> Fecha: Wed, 14 Jun 2000 23:28:21 -0400
> Para: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Asunto: That dang FldInsert()
>
> Hello All,
>
> I am working on a program and I want to have the user be able to enter
> numbers into an editable text field using an onscreen keyboard or using
> graffiti. The graffiti part works just fine but I cann't get my keyboard to
> work. Code is as follows:
>
>
> //from mainfrom event loop
>
> Char* theDigit;
> FieldPtr fieldPtr;
>
> case ctlSelectEvent:
> switch (eventP->data.ctlSelect.controlID)
> {
> case (MainOneButton):
> theDigit = "1";
> break;
> case (MainTwoButton):
> theDigit = "2";
> break;
> //code removed here to shorten post....
>
> fieldP = GetFocusObjectPtr(); //gets field with the focus
> appendCharToField (fieldP, theDigit);
>
> //more code removed
>
>
> //code to insert theDigit into the text field
>
> static void appendCharToField (FieldPtr fieldP, Char* theDigit)
> {
> FldInsert (fieldP, theDigit, 1);
> }
>
>
> Everything compiles fine but when I tap keyboard buttons, nothing happens.
> Nothing is inserted into the field. What am I doing wrong here. Should I not
> be using FldInsert() to do this? I thought it would be easier than getting
> the text out of the field, then altering it and placing it back into the
> field.
>
> Any help is appreciated.
>
> Thanks,
>
> Andy
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please
> see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/