Link to home
Start Free TrialLog in
Avatar of adchar43
adchar43

asked on

How to draw/get a text string in a Field

I am programing a simple database application for Palm using Palm Development Suite downloaded from http://www.palmsource.com.
I got a problem when putting a text in a Field Control.
Some Field Function can do this but they all need FieldType Pointer such as:

void FldSetText (
   FieldType *fldP,
   MemHandle textHandle,
   UInt16 offset,
   UInt16 size
)

Char *FldGetTextPtr (
   const FieldType *fldP
)
.....



And i don't know how to get this Pointer. All i have here is FieldID only. I also need to get a Pointer(FormType*) of a Form when having it's ID.
I want that when i click on a button, my Field has to show a given text string.
Help me, thanks.
ASKER CERTIFIED SOLUTION
Avatar of Ivan Rivera, MTI, SCPM, ITIL, Cobit, PMP
Ivan Rivera, MTI, SCPM, ITIL, Cobit, PMP
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adchar43
adchar43

ASKER

Thanks for you help but i am having a little bug, i can not get the pointer of my Field although i have my field's ID.
I use this function:

static void *GetObjectPtr(UInt16 rsrcID)  //<== COPY FROM DOCS
{
      FormPtr formP;
      formP = FrmGetActiveForm();
      return FrmGetObjectPtr(formP, FrmGetObjectIndex(formP, rsrcID));
}

Fieldp = (FieldType *)GetObjectPtr(fieldFirstName);  <== Error cause by this function, i don't know why, i read in docs and they use this function like me.

------------
In your post above, is the function getObjectPtr the same with my function?

I have the ID of the field resource, i want to set a text on this field, the text from Char * string(to test) not from my database.


Thanks
---------------------
On your code above:
FieldPtr fld;                             // THIS IS THE FIELD POINTER
fld = GetObjectPtr (NoteField);       // HERE YOU GET THE INFO
---------------------
Is the function GetObjectPtr the same with my function and is NoteField = Your field ID?

Could you please post all the code and the error message to try to figure out whats happening?

Thnks

Ivan Rivera
I founded my error, that i can not get the pointer of the Main Form and that cause this error.
My new PROBLEM here :D

I CAN NOT GET THE POINTER OF THE MAINFORM, AND I DON'T KNOW WHY

https://www.experts-exchange.com/questions/21222707/Strange-problem-with-getting-Form-pointer.html