Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TRichEdit and TFrame

Posted on 2009-02-17
9
Medium Priority
?
438 Views
Last Modified: 2013-11-17
Hello everyone!

I'm using C++ Builder 6.0 and I have a TFrame with inside a TPageControl where in  a page I have a TRichEdit.
The fact is: I load some text from a database field into TRichEdit's text (and with debug I see I have text) but when I show the richedit I see like empty richedit.
Indeed I have a TRichEdit in another simple form and I can see the text... As you know it is maybe a bad issue between TRichEdit being in a TFrame instead of a TForm?...
Is there maybe a way to solve it, for example with API calls?...

Thanks a lot to everyone!
Ciao,
Luigi
edtDocumentation->Text = ADOQuery_Qry->Fields->Fields[2]->AsString;

Open in new window

0
Comment
Question by:npuleio
  • 6
  • 3
9 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 23664375
Ciao Luigi,
To add strings in a TrichEdit its the same as TMemo:
TRichEdit->Lines->Add(TheAnsiString);
or TStrings:
TRichEdit->Lines = TStringList;
so if edtDocumentation = TRichEdit
then:
edtDocumentation->Lines->Add(ADOQuery_Qry->Fields->Fields[2]->AsString);

George Tokas.
0
 

Author Comment

by:npuleio
ID: 23667977
Hello George....

if I do that I get an exception "RichEdit line insertion error" doing the ->Add(...->AsString); thing and the text is just fine since when I inserted the text into database I did a paste from a Word document...

Same thing happens if I do:

TStringList* stringdocument = new TStringList();
stringdocument->Add(ADOQuery_Qry->Fields->Fields[2]->AsString);
edtDocumentation->Lines->AddStrings(stringdocument);

ciao,
Luigi
0
 

Author Comment

by:npuleio
ID: 23670351
Hello again,

I have also a TWinControl component where I created a format-text toolbar and a RichEdit, where specifically for the RichEdit I passed to the ancestor something like this:

#define RICHEDIT30 "Riched20.dll"

if (!_RichEditModule)
  _RichEditModule = ::LoadLibrary(RICHEDIT30);

if (_RichEditModule != 0) {
  Ancestor::CreateParams();
  CreateSubClass(Params, RICHEDIT_CLASSA);
  ...
  ...
}

So I would manage also TStrings Lines... how I could get and pass Lines between the handle creating a property Lines?...

Thanks
Ciao, Luigi
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:npuleio
ID: 23681136
Actually, to avoid that exception "RichEdit line insertion error", I put an ugly try { .... } catch(Exception &e) { } at least it works...

Ciao, Luigi
0
 

Author Comment

by:npuleio
ID: 23782030
Couldn't get a good answer actually... and it works quite OK with a try { } catch(Exception &e) { } so I solved it with that.
For a moderator, can be this question closed?..Thanks
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 23782567
Ooops...
Sorry...
Forgot to answer...
I'll be back to you in a few hours....

George Tokas.
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 23786938
Hello again Luigi,
I tried having a RichEdit control in a frame and I added lines and from a control (TButton) outside the frame and works ok...
Try the following:
AnsiString S;
S = ADOQuery_Qry->Fields->Fields[2]->AsString;
RichEdit->Lines->Add(S);
Is that failing also??

George.
0
 

Author Comment

by:npuleio
ID: 23787115
I tried that too but it failed too... I tried also something like this:

TStringList* ts = new TStringList(ADOQuery_Qry->Fields->Fields[2]->AsString);
RichEdit->Lines->Add(ts);

since Lines is a TStrings, but it failed that too...
0
 

Accepted Solution

by:
npuleio earned 0 total points
ID: 24325252
Since I haven't solved the problem I abandoned using RichEdit in that situation with Frame and I used indeed a TMemo and gave up.

Maybe there's some sort of incompatibility between RichEdit and Frame so I would close this question...

Thanks anyway....

Ciao,
Luigi
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question