> From: Johnathan Smith
>
> I am trying to make a form that will take two
> TextFields and add them out and display the total on
> the form for the user to see.

Earlier today, I posted code to do exactly this (see
http://groups.yahoo.com/group/palm-dev-forum/message/59488).  If you want to
ignore non-numeric characters, make the fields Numeric.  Then the OS will
only allow the characters 0 through 9 and the thousands separator and the
decimal character to be entered in the field.

> ...
> I also fell that someone most know a
> better way to get the data from the TextField.

Why must there be a "better way"?  You can use FldGetTextHandle() or
FldGetTextPtr().  On the Palm OS, blocks of memory ("chunks") are normally
relocatable.  If you want to access a relocatable memory chunk, first you
get a handle to that chunk.  If you want to mess with that memory, you lock
it and get a pointer.  While it is locked, it can't be moved around.  After
using it, you unlock it so the OS can move it around if it needs to.  Later,
when you are totally done with the memory, you free it.

So, to access memory:

1. SomeHandleType h = MemHandleNew(size);
   SomePointerType p = MemHandleLock(h);
   // use h ..., then
   MemHandleUnlock(h);
   MemHandleFree(h);

-or-

2. SomePointerType p = MemPtrNew(size);
   // use p..., then
   MemPtrFree(p);


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

Reply via email to