Solved

C++ Builder Problem

Posted on 2000-04-19
6
198 Views
Last Modified: 2010-04-10
Hi there,
I have a major problem with something I am working on.  I just can not seem to get it working.  I am trying to reference a TRichEdit Control from a program which I added into my Project.
I am trying to read in each line from the TRichEdit control and Copy it into a temp buffer.
The name of the Richedit control is: Editor and the form it is on is EditForm(This is an MDIChild Form).

Any help would be much appreciated -Cheers
Elmo
0
Comment
Question by:Elmo_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2731015
You can use Lines Property. Next is code:
....
   char buff[121];
   int n = RichEdit1->Lines->Count;
   for (int i = 0; i < n; i++)
     {
       AnsiString ptr = RichEdit1->Lines->Strings[i];
       strcpy(buff, ptr.c_str());
     }
.....

I hope, it helps. Alex
0
 
LVL 3

Author Comment

by:Elmo_
ID: 2731102
Alex,
      I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
      Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
      I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
      Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132];      //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
      Elmo_
0
 
LVL 3

Author Comment

by:Elmo_
ID: 2731106
Alex,
      I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
      Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
      I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
      Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132];      //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
      Elmo_
0
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!

 
LVL 3

Author Comment

by:Elmo_
ID: 2731341
Alex,
I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132]; //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
Elmo_
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 2731570
You must simple add in you h/cpp file:
extern *TRichEdit Editor;
(if  Editor is name of you RichEdit
Control)
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2732165
You ALMOST have it... note the refrence to EditForm->Editor...



Good luck!!


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132]; //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = EditForm->Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = EditForm->Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

630 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