Sunit Katkar's Home Page

 Palm Tutorial:



 Palm Links:
 


Separating the GUI from the Data:

Basically our forms should not be aware of this structure. Each form on opening should read from the structure instance by using a Get function. On exiting (i.e. another form is asked to open) the text from the fields on the current form should be stored in this structure instance by using the Set functions. By using Set and Get functions the GUI remains quite separate from the memory, string and database record handling.

The following functions are key to our application:

1) ConstructMultiFieldFormDocument (CharPtr psz)

  • Argument to this function is pointer to a record in the database.

  • This function reads the packed string and splits into 'three unpacked' strings.

  • It populates the structure instance with the three strings

2) ToStringMultiFieldFormDocument (CharPtr dst)

  • Argument to this function is pointer to a temporary buffer.

  • This function converts the structure instance into a packed string.

3) RetrieveData()

  • This function gets a pointer to the record data from the database

  • Passes this pointer to the ConstructMultiFieldFormDocument() function

4) SaveData()

  • This function gets a pointer to the record data from the database

  • Writes the string prepared by ToStringMultiFieldFormDocument() into this record.

Main |  1 |  2 |  3 |  4 |  5 |  6