Hi,
I have written a small piece of code that output some text in the command window using 'cout<<whatever'. I'd like it to print out in the Form(e.g a Label or something) instead. What do I need to do?
Thanks
sKar
Hi,
I have written a small piece of code that output some text in the command window using 'cout<<whatever'. I'd like it to print out in the Form(e.g a Label or something) instead. What do I need to do?
Thanks
sKar
I used Edit1->Text = "whatever"; inside the:
void __fastcall TForm1::ButtonZClick(TObject *Sender)
{
}
however, it only reacts when I click on the button.
I want to have an if loop outside the onclick action, for checking states in the program, but I can't use the Edit1->Text = "whatever"; in the main program as an error msg of undefined symbol 'Edit1' comes up.
how do I change the caption as soon as the program is running, rather than having to click something first?
Thanks
sKar
Hmmm, I´m dont understand the question??? Should it change caption on the form when the program starts running or??? Give me some more info and I think I can help you.
There are 2 state in my program, top and bottom
by enum state{top, bottom} currentstate=top;
the inital state is top and I want the Label->Caption to display "a to E"
then when I click on a button, the currentcurrent state change to bottom and the label->caption becomes "A"
I can make the caption change when I click the button, but not when the currentstate is initialised to top.
my idea was something like:
int main()
{
if(currentstate==top)
Label1->Caption="A toE";
then the code for the button click
}
but the Label1 in the main program is undefined!
Oki, I think I get the point. First you should initiate currentstate to top in the OnCreate (or FormCreate) event for the form. Then in the onlick-event
void __fastcall TForm1::ButtonZClick(TObject *Sender)
{
//Change currentstate each time you click on button
if(currentstate==top)
{
Label1->Caption="A toE";
currentstate = bottom;
}
else
{
Label1->Caption="A";
currentstate = top;
}
}
Hopefully this should work. Did it???
Done, Thanks!
more questions in other threads