I am writing a application in Builder v.6 using few Standard objects like Buttons and MainMenu.
I have following problem.
When in object TForm2::Wspolczynnikikanaludopliku1Click I want to get the value of variable drop_number declared and definited in object TForm2::Button1Click I get fallowing error:
[C++ Error] fMIMO_channel.cpp(279): E2288 Pointer to structure required on left side of -> or ->*
The -> operator doesn't do what you seem to think.
You can't get a variable from another function like that. Typically you'd have the function return a value and call the function in order to get the value. But since "Button1Click" seems like a function that is triggered by a GUI event (a button click perhaps? =P) I'm guessing that solution won't work here.
What you can do is instead of putting drop_number in Button1Click, you can put it in TForm2:
class TForm2
{
...
int drop_number;
...
};
//-----------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
// don't do int drop_number here
...
drop_number = /*whatever*/;
}
//------------------------
void __fastcall TForm2::Wspolczynnikikanaludopliku1Click(TObject *Sender)
{
int liczba_D;
...
liczba_D = drop_number;
}
Whether or not this is really a good solution is another matter, though. I don't really have an idea of what the big picture is here. Something tells me there's something deeper that's wrong with your program logic -- and this tweak might not work.