Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C++ Builder Problem

Posted on 2000-04-19
6
Medium Priority
?
199 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
Independent Software Vendors: 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 200 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

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.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

722 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