Hi Dan

        I open the address database and fill in a local structure with a
subset of information from the address fields, I then close the database
and only work with this internal structure. However, I would like the
string of the category selected from the address book to maintain itself
throughout the app until its changed. I think in this situation the
problem is different. Maybe I cannot use categoryselect with a databse
and then close it?

Cheers
Jeff


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan
Phelan
Sent: 16 April 2004 20:46
To: Palm Developer Forum
Subject: Re: CategorySelect Issue


Jeff,

Yes, you need to do a couple of things:

1)  Define an AppInfo structure. (see below)
2) When your Dbase is loaded or first created, initialize the
Categories. (see InitAppInfo )

Then the dbase header info is ready for CategorySelect().

 Hope this helps.

Dan


**************
SAMPLE ...
**************
/***********************************************************************
****
***
 *
 * myApp Info information Data Structures
 *
 *  First Made for categopry support on viewing association records

************************************************************************
****
*/
typedef struct
{
   UInt16 renamedCategories;
   Char categoryLabels[dmRecNumCategories][dmCategoryLength];
   UInt8 categoryUniqueIDs[dmRecNumCategories];
   UInt8 lastUniqID;
   UInt8 reserved1;

} myAppInfo;

/***********************************************************************
****
******
*
*   InitAppInfo:
*
*   Initializes the App Info portion of the database header, and sets
the
category
*   area
*
*   INPUTS: pDB = ptr to MY db, Called after the DB is loaded or created
*
************************************************************************
****
*******/

Err
InitAppInfo (DmOpenRef pDB)
{
   UInt16 cardNo;
   MemHandle handle;
   LocalID dbID;
   LocalID appInfoID;
   myAppInfo * pAppInfo; // Need to define a structure, see above
   myAppInfo * pNull = 0;

   Boolean bSetUpCategories = false;

   //Version Information
   UInt16 version =1;
   //UInt8 *majorMinor;
   //majorMinor = (UInt8 *) &version;

  //majorMinor[0] = 1;
  //majorMinor[1] = 1;


   if ( DmOpenDatabaseInfo ( pDB, &dbID, NULL, NULL, &cardNo, NULL ))
   {
      return dmErrInvalidParam;
   }
   if ( DmDatabaseInfo ( cardNo, dbID,
                         NULL,
                         NULL,
                         &version,
                         NULL,
                         NULL,
                         NULL,
                         NULL,
                         &appInfoID,
                         NULL,
                         NULL,
                         NULL ))
   {
      return dmErrInvalidParam;
   }


   //AppInfo Block not setup if NULL

   if ( NULL == appInfoID )
   {
      handle = DmNewHandle ( pDB, sizeof (myAppInfo) );
      if ( NULL == handle )
      {
         return dmErrMemError;
      }

      appInfoID = MemHandleToLocalID ( handle );
      DmSetDatabaseInfo ( cardNo, dbID,
                         NULL,
                         NULL,
                         &version,
                         NULL,
                         NULL,
                         NULL,
                         NULL,
                         &appInfoID,
                         NULL,
                         NULL,
                         NULL );

      pAppInfo = (myAppInfo *)MemLocalIDToLockedPtr ( appInfoID, cardNo
);
      DmSet(pAppInfo, 0, sizeof ( myAppInfo ), 0 );

      CategoryInitialize ( (AppInfoPtr)pAppInfo, CategoriesAppInfoStr );
      MemPtrUnlock ( pAppInfo );
   }
   return 0;
}

----- Original Message -----
From: "Jeff Leal" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, April 16, 2004 3:14 PM
Subject: RE: CategorySelect Issue


> Dan,
>
> As I understand it, if I use CategorySelect() I do not need to call 
> CategoryInitialize(). Is this correct?
>
> Jeff
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Dan 
> Phelan
> Sent: 16 April 2004 19:54
> To: Palm Developer Forum
> Subject: Re: CategorySelect Issue
>
>
> Jeff,
>
> I have had that happen when the CategoryInitialize() was not setup 
> when the database was created. Or, a newer application is loaded over 
> an existing one, and the old dbase structure was not set for 
> categories.
>
> Dan
>
> ----- Original Message -----
> From: "Jeff Leal" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Friday, April 16, 2004 2:46 PM
> Subject: CategorySelect Issue
>
>
> > Hi
> >
> > I've managed to get CategorySelect working, however everytime I 
> > update
>
> > the display the selected category string gets filled with rubish. It

> > seems like I am writing to some wrong address but I've disabled all 
> > writing and I still get this efect.....anyone know the answer?
> >
> > Cheers
> > Jeff
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to 
> > unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.658 / Virus Database: 421 - Release Date: 4/9/04
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,

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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.658 / Virus Database: 421 - Release Date: 4/9/04


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



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

Reply via email to