Hy all! I would like to make a function that will be called from the frmOpenEvent and will populate a list with some records.
I have been made the function and the database access is working well but, when i implement the routines to clear the list and the points to the list, the compiler generates a error. Does anybody knows what is going wrong??? Thanks! /************************************************************************ * * Created with Falch.net DeveloperStudio * http://www.falch.net/ * * File : @FILENAME * * Description : * * History: * Name Date Description * ---- ---- ----------- * Administrador 13/01/2003 19:23:29 Created * ***********************************************************************/ #include <PalmOS.h> #include "SIR_Palm.h" #include "SIR_Palm_res.h" static Boolean frmRCAS_txtNOME_OnfldEnter(EventPtr event) { // Insert code for txtNOME SysKeyboardDialog (0); return true; } static Boolean frmRCAS_txtCOD_OnfldEnter(EventPtr event) { // Insert code for txtCOD SysKeyboardDialog (1); return true; } /*********************************************************************** * * FUNCTION: frmRCAS_HandleEvent * * DESCRIPTION: Handles a Form event * * PARAMETERS: event pointer to an event structure * * RETURNED: returns handled/not handled * * REVISION HISTORY: * Name Date Description * ---- ---- ----------- * Administrador 13/01/2003 19:23:29 Created * ***********************************************************************/ Boolean frmRCAS_HandleEvent(EventPtr event) { FormPtr form; Boolean handled = false; switch (event->eType) { case fldEnterEvent: switch (event->data.fldEnter.fieldID) { // txtNOME receives an event case txtNOME: handled = frmRCAS_txtNOME_OnfldEnter(event); break; // txtCOD receives an event case txtCOD: handled = frmRCAS_txtCOD_OnfldEnter(event); break; } break; case frmOpenEvent: // Repaint form on open form = FrmGetActiveForm(); FrmDrawForm(form); handled = true; //Call the function that will clear the list and will load the Clients... loadRCAS(0); break; default: break; } return handled; } //////////////////////////////////////////////////////////////////////////// / //////////////////////////////////////////////////////////////////////////// / //////////////////////////////////////////////////////////////////////////// / //Define variaveis de acesso ao banco de dados p/ uso no carregamento de RCAS #define DB_NAME "SIRRca" #define DB_CARDNO 0 #define DB_CREATOR 'SIRP' #define DB_TYPE 'DATA' static DmOpenRef dbPtr = NULL; //Abre o banco de dados (Open database) static Open(void) { // Open the database or create it if it doesn't exist: if(dbPtr == NULL) { //Busca o Banco de Dados (Search database...) LocalID dbID = DmFindDatabase(DB_CARDNO, DB_NAME); //Abre o banco de dados (Open it) dbPtr = DmOpenDatabase(DB_CARDNO, dbID, dmModeReadWrite); if(dbPtr == NULL) return; } return; } //Open the database and load the clients... void loadRCAS(UInt16 Modo) { ////////////THE ERROR APPEAR WHEN I PUT THE FOLLOWING LINES: ListType *lstP; FormType* frmP = FrmGetActiveForm(); lstP = (ListType *) FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, lstTCAS)); ///////////////////////////////////////////////////////////////////// //looks if the database is already open... Err err = Open(); if(err) return; else { //Ok. O banco de Dados est� aberto... //Faz um LOOP do n�mero de records presente no banco de dados UInt16 Count; for (Count=0; DmNumRecords(dbPtr); Count++) { //Abre o RECORD para leitura MemHandle h = DmQueryRecord(dbPtr, Count); //Verifica se eu realmente peguei um bom segmento de memoria if (!h) return; else { //Trava o segmento, de modo que eu possa ler dele Char *cod = (Char *) MemHandleLock(h); UInt16 codLen = StrLen(cod); Char *nom = cod + codLen + 1; //Aqui inicia o processo de escrever colocar os nomes nas listas... } } } } Log generated by compiler: Starting to build D:\PROGRA~1\Falch.net\SIR_Palm\SIR_Palm.FNP Time: 14/01/2003 01:16:55 ------------------------- Compiling resource SIR_Palm.rcp... PilRC 68k v2.7b Copyright 1997-1999 Wes Cherry ([EMAIL PROTECTED]) Copyright 2000-2001 Aaron Ardiri ([EMAIL PROTECTED]) Compiling frmRCAS.c... frmRCAS.c:130: warning: type mismatch with previous implicit declaration frmRCAS.c:91: warning: previous implicit declaration of `loadRCAS' frmRCAS.c:130: warning: `loadRCAS' was previously implicitly declared to return `int' frmRCAS.c: In function `loadRCAS': frmRCAS.c:142: parse error before `err' frmRCAS.c:143: `err' undeclared (first use in this function) frmRCAS.c:143: (Each undeclared identifier is reported only once frmRCAS.c:143: for each function it appears in.) make: *** [Debug/frmRCAS.o] Error 1 ----------------------- Make returned an error. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
