You need to redraw the field after you set the handle for it (assuming you're
not doing this elsewhere). Do this with FldDrawField(fldLogin). I'm pretty
rusty with my C/C++ but I think there may also be a problem with the line:
newText = rP->login. This may set the newText pointer to point to the data in
rP->login and not actually copy that data to the allocated space for newText.
You may try StrCopy(newText, rP->login) instead.
Hope this helps.
Kevin Bosak
[EMAIL PROTECTED]
Susana Gascon Moreno wrote:
> Hi everybody!!
>
> This is mi problem. I store in a record a structures composed of two Char*,
> with that nothing happens, but when I try to display these two fields each
> one in a field text i can�t.
> At the beginning the record was just a Char* and so I had no problem to
> display it in a field text, But now I can�t.
> I have gone through the knowlegde base and I haven�t found nothing similar,
> even through all the questions and answers.
> Please need help.
>
> I am sending you part of my code, the one that retrieves the record from the
> database and tries to write it to the fields text.
>
> static void GetRecordConfigurationDB (FieldPtr fldLogin, FieldPtr
> fldServerN)
> {
>
> UInt16 index = 0;
> UInt16 mode;
> Char* newText;
> ConfigurationRecDBType* rP;
> MemHandle rH;
> MemHandle newHandle;
>
> // Open the DB and read the record to draw it on the form.
> mode = dmModeReadOnly;
> // Find the DB, if it doesnt exist then returns 0
> ConfigurationDB = DmOpenDatabaseByTypeCreator(configurationDBType,
> configurationBDCreator, mode);
>
> // Get a handle for the record in position index
> rH = DmGetRecord (ConfigurationDB, index);
> // Lock down the handle and get a pointer to the record data
> rP = MemHandleLock(rH);
>
> // Allocate a new memory chunk that will contain a copy of the data.
> newHandle = MemHandleNew(sizeof(rP->login));
> // Lock down the handle and get a pointer to the memory chunk.
> newText = MemHandleLock(newHandle);
>
> // Copy the data from the record to the new memory chunk.
> newText = rP->login;
>
> // Unlock the new memory chunk.
> MemHandleUnlock(newHandle);
>
> // Set the field's text to the data in the new memory chunk.
> FldSetTextHandle(fldLogin, newHandle);
>
> // Unlock the database record
> MemHandleUnlock(rH);
>
> // Release the record to the database system
> DmReleaseRecord (ConfigurationDB, index, false);
>
> // Close the DB
> DmCloseDatabase(ConfigurationDB);
> }
>
> Don�t get any problem when I compile it or running it but it doesn�t display
> anything.
>
> Thanks in advance!!
>
> Susana Gasc�n Moreno
> Germinus Solutions
> [EMAIL PROTECTED]
> Tfno: 951010583
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/