I'm getting error NULL String parameter.
Can any body tell why i'm getting this.
Do i need to set and get the text fields.

static Boolean AboutHandleEvent(EventPtr event);

static VoidHand hchoices;
static VoidHand hpchoices; 
static void newRecord(void); //new record
static VoidPtr getObject(FormPtr,Word);
static DmOpenRef OrderDB;
static ULong numRecords;
static UInt cursor;
static Boolean isDirty;
static VoidHand hrecord;
static void drawTable( void ); //draw table and rows
static void drawCell( VoidPtr table, Word row, 
                Word column, RectanglePtr bounds );
//Constants that define the Order Line database record

#define DB_ID_START 0
#define DB_ID_SIZE (sizeof(ULong))
#define DB_ITEM_START (DB_ID_START + DB_ID_SIZE)
#define DB_ITEM_SIZE 16
#define DB_SEAT_START (DB_ITEM_START + DB_ITEM_SIZE)
#define DB_SEAT_SIZE 16
#define DB_RECORD_SIZE (DB_SEAT_START + DB_SEAT_SIZE)
/*  */
#define TABLE_NUM_COLUMNS 6
#define TABLE_NUM_ROWS 4
#define TABLE_COLUMN_ITEM 20
#define TABLE_COLUMN_SEAT 2

DWord PilotMain(Word cmd,Ptr,Word)//start up forms
{
        FormPtr form;
        EventType event;
        Word error;
        Word x;
        
        if(cmd!=sysAppLaunchCmdNormalLaunch)
                return(0);
                
if(((error=DmCreateDatabase(0,"OrderDB PPGU", 'PPGU',
'ordr',false))!=dmErrAlreadyExists)&&(error!=0))
                {
                 FrmAlert(DBCreationErrorAlert);
                 return(0);
                }

        OrderDB=DmOpenDatabaseByTypeCreator('ordr',
'PPGU',dmModeReadWrite);                
        numRecords=DmNumRecords(OrderDB);
        cursor=0;
        for (x = 0;x < 3; x++)
                {
                 newRecord();
                 FrmGotoForm(AboutForm);
                                        }
                
        do
        {
                EvtGetEvent(&event, -1);
                        if(SysHandleEvent(&event))
                                continue;
                        if(event.eType==frmLoadEvent)
                switch(event.data.frmLoad.formID)
                                        {
                        case AboutForm:                 form=FrmInitForm(AboutForm);   
         
FrmSetEventHandler(form,AboutHandleEvent);
                         break;
                 } // end switch        
          FrmSetActiveForm(form);
          FrmDispatchEvent(&event);
        } while (event.eType != appStopEvent);  
        FrmCloseAllForms();
        DmCloseDatabase(OrderDB);
        return(false);
        }

static Boolean AboutHandleEvent(EventPtr event)         {
                FormPtr form;
                switch(event->eType)
                {
                        case frmOpenEvent:
                        form=FrmGetActiveForm();
                                {
                                FrmDrawForm(form);
                                drawTable();
                                }
                        break;
        }
        return(false);
}

static void drawTable( void )
{
        FormPtr form;
        TablePtr        table;
        Int             column;
        Int             count;
        form = FrmGetActiveForm();
        table = getObject( form, AboutItemsTable );
for (column = 0; column < TABLE_NUM_COLUMNS; column++
)
        {
TblSetCustomDrawProcedure( table, column, drawCell );
        TblSetColumnUsable( table, column, true);
        }
for(  count = 0; count < TABLE_NUM_ROWS;count++ )
        { 
        if( count < numRecords )
                {
TblSetRowUsable( table, count, true );
                        
for( column = 0; column < TABLE_NUM_COLUMNS; column++
)
                        {
TblSetItemStyle( table, count, column,labelTableItem
);
                        }
                }
                else
                TblSetRowUsable( table, count, false );
        }
        TblDrawTable( table );  
}
 
static void drawCell( VoidPtr table, Word row, Word
column, RectanglePtr bounds )
 {
        Int record;
        CharPtr precord;
        Char string[DB_ITEM_SIZE];
        SWord width;
        SWord len;
        Boolean noFit;
        record = cursor + row;
        hrecord = DmQueryRecord(OrderDB, record );
        precord = MemHandleLock( hrecord);
        
        switch( column )
        {
                case TABLE_COLUMN_ITEM:
                {StrCopy( string, "-" );
                }
                break;
                case TABLE_COLUMN_SEAT :
                {StrCopy( string, "-" );
                }
                break;
                                }       
        MemHandleUnlock( hrecord );
        WinSetUnderlineMode( noUnderline );
        FntSetFont( stdFont );
        width = bounds->extent.x;
        len = StrLen( string );
        noFit = false;
FntCharsInWidth( string, &width, &len, &noFit );
        WinEraseRectangle( bounds, 0 );
    WinDrawChars( string, len, bounds->topLeft.x,
bounds->topLeft.y);
        return;
}

static void newRecord( void )
{
VoidPtr precord;        // CH.5 Pointer to the record
hrecord = DmNewRecord( OrderDB, &cursor,DB_RECORD_SIZE
);
        precord = MemHandleLock( hrecord );
        DmSet( precord, 0, DB_RECORD_SIZE, 0 );
        MemHandleUnlock( hrecord );
        DmReleaseRecord( OrderDB, cursor, true );
        numRecords++;
                isDirty = true;
                return;
}
static VoidPtr getObject(FormPtr form, Word objectID)
{
  Word index;
  index = FrmGetObjectIndex(form, objectID);
  return(FrmGetObjectPtr(form, index));
}       


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
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