Hi Ralph. I had already begun preprocessing the clipboard string, to remove thousands characters and help simplify the paste process. This, combined with your method of switching back and forth between numeric and non-numeric, will probably solve my problem. Thanks, very much, for your suggestion. Bob.

Ralph Curtis wrote:

"Robert Moynihan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


Hi folks,

I just noticed a bug in my app, and I've been looking through the SDK and


message archives,... and scratching my head...


I have some numeric fields, and I'm having trouble pasting data into it.


For instance...


Current field value:  "10.5"
Hilight all 4 field characters
Copy
Backspace to delete the characters
Paste
** All 4 chars paste OK

Hilight all 4 characters again
Paste
** error beep

Erase ONLY the decimal point
Hilight all 3 characters
Paste
** All 4 chars paste OK

It seems like the error only happens when the paste string AND field


string contain a decimal point, and the fields numeric attribute is set.


Anybody have any insight into this, or am I just seeing things?

Thanks.  Bob.





I could never find an answer to this, so I worked around it. Goes something like this:

   case EditPaste: // Work around for Palm "pasting to numeric" field bug
    {
       FieldAttrType attr;
       FieldPtr fldP = getFocusField(frmP);
       if(fldP) {
         FldGetAttributes (fldP, &attr);
         if (attr.numeric) {
           if (isValidNumericClipboardText()) {
             attr.numeric  = false;
             FldSetAttributes (fldP, &attr);
             FldPaste(fldP);
             attr.numeric = true;
             FldSetAttributes (fldP, &attr);
             FldSetDirty(fldP, true);
         }
        else {
           FrmCustomAlert(InfoAlert, "Invalid Paste: Require a positive
numeric value.",
                     EMPTY_STR, EMPTY_STR);
         }
         handled = true;
       }
     }
    }
    break;







--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to