Hy!

I tried the code bellow, but it's no working

Can anybody tell me why?

This is the code of where I'm trying to call the variable:
//////////////////////////////////////////////////////
FILE global.h
#ifndef GLOBAL_H_INCLUDED
#define GLOBAL_H_INCLUDED

//VAriavel Global - Nome do RCA Selecionado
extern Char *GlobalRCASel;

#endif


//////////////////////////////////////////////////////

THE FISRST FORM - WILL SET THE VARIABLE VALUE:

#include <PalmOS.h>
#include "SIR_Palm.h"
#include "SIR_Palm_res.h"
#include "list_manip.h"
#include "frmRCAS.h"
#include "global.h"                        //INCLUDE GLOBAL.H

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

DmOpenRef dbPtr;

////////////////////////////////////////////////////////////////////////////
/
//Define opcoes sobre a lista...
////////////////////////////////////////////////////////////////////////////
/
#define MAX_LIST_ENTRIES 200
Char* listEntries[MAX_LIST_ENTRIES];
UInt16 nextListEntry = 0;

////////////////////////////////////////////////////////////////////////////
static Boolean frmRCAS_cmdAvancar_OnSelect(EventPtr event)
{

// Insert code for cmdAvancar
FormType *form;
ListPtr lptr;

//Ponteiro p/ a variave Global
Char *GlobalRCASel;

form = FrmGetActiveForm();
lptr = (ListPtr)FrmGetObjectPtr(form, FrmGetObjectIndex(form, lstRCAS));

//Copia o nome do RCA para a variavel Global
//SET THE VALUE OF THE VARIABLE - PALM GENERATES A ERROR...
StrCopy(GlobalRCASel,LstGetSelectionText(lptr,LstGetSelection(lptr)));

//Chama o form;
FrmGotoForm(frmRCAInfo);
return true;

}





"Matthew Bevan" <[EMAIL PROTECTED]> escreveu na mensagem
news:109602@palm-dev-forum...

Done and done... this is a three-file example:

--FILE 1: Globals.h--
extern Char *bob;

--FILE 2: Form1.c-- (variable defined here)
#include "Globals.h"

Char *bob = "This is a global variable.";

// access bob as you would any normal variable - anywhere

--FILE 3: Form2.c-- (variable used here)
#include "Globals.h"

// access bob as you would any normal variable - anywhere

--END--

Hope that helps.  It's usually a good idea to keep the global variable
definitions grouped in some reasonable manner (i.e. keep all the VFS vars
together, all of the current state ones together, etc.)

--
Matthew (Darkstorm) Bevan       [EMAIL PROTECTED]
Margin Software, NECTI. http://www.marginsoftware.com
Re-inventing the wheel, every time.

 - Afternoon, n.:
That part of the day we spend worrying about how we wasted the
morning.






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

Reply via email to