Solved

C++ Builder Problem

Posted on 2000-04-19
6
194 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_
  • 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

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