Changing text of a Memo object
Hi all,
I've only just started with Fast Reports and while I've managed to work most things out I'm struggling with something really simple.
I need to be able to change the text of a memo object with code before displaying the report. The object is created using the designer but I cannot seem to change the text. I've seen Delphi examples but I'm using C++ Builder and having altered the code for that nothing seems to happen. I suspect I am not identifying the object correctly but am unsure quite what is wrong.
My code is
TfrxMemoView *pText = NULL;
pText = new TfrxMemoView(frxReport1->FindObject("Memo1"));
pText->Text = "New Text";
Any thoughts on what I am doing wrong would be greatly appreciated.
I've only just started with Fast Reports and while I've managed to work most things out I'm struggling with something really simple.
I need to be able to change the text of a memo object with code before displaying the report. The object is created using the designer but I cannot seem to change the text. I've seen Delphi examples but I'm using C++ Builder and having altered the code for that nothing seems to happen. I suspect I am not identifying the object correctly but am unsure quite what is wrong.
My code is
TfrxMemoView *pText = NULL;
pText = new TfrxMemoView(frxReport1->FindObject("Memo1"));
pText->Text = "New Text";
Any thoughts on what I am doing wrong would be greatly appreciated.
Comments
I'm not a C++ programmer, but from a C perspective, I'd try a cast rather than a new:
pText = (TfrxMemoView)(frxReport1->FindObject("Memo1"));
TfrxMemoView * pText =
dynamic_cast <TfrxMemoView *> (frxReport1->FindObject("Memo1"));
pText->Text = (L"New Text");