Using elements of a Form within a function

0

I'm developing an application in C ++ Builder that has a Form that contains elements like ListBox , buttons, Labels , etc.

I can configure the events of each of these elements ( onClick , onEnter , onExit ...) within a .cpp file, however when I try to create a function inside this same .cpp that accesses the properties of the elements ( Visible , Enabled , Caption , etc.) I get an error:

  

"undefined symbol".

How do I use the elements contained in a Form within a function created by me.

Follow problem code.

//Função criada por mim, dentro da Unit1.cpp que contem o Form1 no qual está o ListBox1

void funcao(AnsiString parametro){ 

 ...
 ListBox1->Items->Add("ItemParaListBox"); //Essa linha gera o erro "undefined symbol ListBox1"

}

//Função de fastcall realizada para edição de evento do elemento dentro da mesma Unit1.cpp

void __fastcall TForm1::BitBtn11Click(TObject *Sender){

...
ListBox1->Items->Add("ItemParaListBox"); //Funciona normalmente

}
    
asked by anonymous 20.01.2015 / 03:05

0 answers