<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Projekt: Text Editor]]></title><description><![CDATA[<p>hallo</p>
<p>ich hab folgendes Problem:</p>
<p>in der Schule muss ich einen Text Editor Programmiern der so ähnlich ist wie der in Windows.</p>
<p>Er soll die eigenschaft besitzen das man z.B. eine Text Datei vom Desktop nimmt und diese dann in die Textbox des Programms zieht und somit die Datei in meinem Editor geöffnet wird.</p>
<p>hat einer eine Idee wie man das im C++ Builder realisiern koennte?</p>
<p>Der Text eingabe bereich ist vom Typ RichEdit!</p>
<p>Hier is der Code des Programms was ich bis jetzt hab:</p>
<pre><code>//---------------------------------------------------------------------------
#include &lt;vcl\vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
#include &quot;Unit2.h&quot;
//---------------------------------------------------------------------------
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
txtfield-&gt;Clear();

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormResize(TObject *Sender)
{
txtfield-&gt;Width = Form1-&gt;ClientWidth;
txtfield-&gt;Height = Form1-&gt;ClientHeight;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Neu1Click(TObject *Sender)
{
txtfield-&gt;Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Speichernunter1Click(TObject *Sender)
{
   if (SaveDialog1-&gt;Execute() == true)
   {
       txtfield-&gt;Lines-&gt;SaveToFile(SaveDialog1-&gt;FileName);
   }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::oeffnenClick(TObject *Sender)
{
 if (OpenDialog1-&gt;Execute() == true)
    {
       txtfield-&gt;Lines-&gt;LoadFromFile(OpenDialog1-&gt;FileName);
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::druckenClick(TObject *Sender)
{
  if (PrintDialog1-&gt;Execute() == true)
    {
//       txtfield-&gt;Lines-&gt;PrintToFile(PrintDialog1-&gt;txtfield);
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &amp;CanClose)
{

switch (Form2-&gt;ShowModal() )
    {
    case mrYes: CanClose = true;
      if (SaveDialog1-&gt;Execute() == true)
       {
          txtfield-&gt;Lines-&gt;SaveToFile(SaveDialog1-&gt;FileName);
       };
    break;
    case mrNo: CanClose = true; break;
    case mrCancel: CanClose = false; break;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ausschneidenClick(TObject *Sender)
{
txtfield-&gt;CutToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Kopieren1Click(TObject *Sender)
{
txtfield-&gt;CopyToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Ein1Click(TObject *Sender)
{
txtfield-&gt;PasteFromClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::loeshcenClick(TObject *Sender)
{
txtfield-&gt;ClearSelection();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FindDialog1Find(TObject *Sender)
{
 	for (int I = 0; I &lt; txtfield-&gt;Lines-&gt;Count; I++)
    {
     int PosReturn = txtfield-&gt;Lines-&gt;Strings[I].Pos(FindDialog1-&gt;FindText);
     	if (PosReturn) {
        	int Skipchars = 0;
            for (int J = 0; J &lt; I; J++)
            	Skipchars += txtfield-&gt;Lines-&gt;Strings[J].Length();
            Skipchars += I*2;
            Skipchars += PosReturn - 1;
            txtfield-&gt;SetFocus();
            txtfield-&gt;SelStart = Skipchars;
            txtfield-&gt;SelLength = FindDialog1-&gt;FindText.Length();
            break;
        }
     }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N1Click(TObject *Sender)
{
 if (FindDialog1-&gt;Execute() == true)
    {

    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ErsetzenClick(TObject *Sender)
{
  if (ReplaceDialog1-&gt;Execute() == true)
    {

    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ReplaceDialog1Replace(TObject *Sender)
{
for (int I = 0; I &lt; txtfield-&gt;Lines-&gt;Count; I++)
    {
     int PosReturn = txtfield-&gt;Lines-&gt;Strings[I].Pos(ReplaceDialog1-&gt;ReplaceText);
     	if (PosReturn) {
        	int Skip = 0;
            for (int K = 0; K &lt; I; K++)
            	Skipchars += txtfield-&gt;Lines-&gt;Strings[K].Length();
            Skip += I*2;
            Skip += PosReturn - 1;
            txtfield-&gt;SetFocus();
            txtfield-&gt;SelStart = Skip;
            txtfield-&gt;SelLength = ReplaceDialog1-&gt;ReplaceText.Length();
            break;
        }
     }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ReplaceDialog1Find(TObject *Sender)
{
for (int E = 0; E &lt; txtfield-&gt;Lines-&gt;Count; E++)
    {
     int wiedergabe = txtfield-&gt;Lines-&gt;Strings[E].Pos(ReplaceDialog1-&gt;FindText);
     	if (wiedergabe) {
        	int Skip = 0;
            for (int T = 0; T &lt; E; T++)
            	Skip += txtfield-&gt;Lines-&gt;Strings[T].Length();
            Skip += E*2;
            Skip += wiedergabe - 1;
            txtfield-&gt;SetFocus();
            txtfield-&gt;SelStart = Skip;
            txtfield-&gt;SelLength = ReplaceDialog1-&gt;FindText.Length();
            break;
        }
     }
}
</code></pre>
<p>Ich hab da noch ein Problem beim Drucken ich kann zwar den PrintDialog aufrufen aber ich weiss nicht wie ich ihm sagen soll was er ausdrucken soll.</p>
<p>Beim Suchen und Ersetzen sind auch noch en Paar fehler:</p>
<p>Suchen: Wenn ich weiter suchen drücke bleibt er beim ersten gesuchten wort</p>
<p>Ersetzen: Er findet zwar das wort aber ersetzt es nicht.</p>
<p>kann mir da jemand helfen?</p>
<p>danke im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/130237/projekt-text-editor</link><generator>RSS for Node</generator><lastBuildDate>Thu, 30 Jul 2026 13:09:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/130237.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Dec 2005 08:23:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 08:23:34 GMT]]></title><description><![CDATA[<p>hallo</p>
<p>ich hab folgendes Problem:</p>
<p>in der Schule muss ich einen Text Editor Programmiern der so ähnlich ist wie der in Windows.</p>
<p>Er soll die eigenschaft besitzen das man z.B. eine Text Datei vom Desktop nimmt und diese dann in die Textbox des Programms zieht und somit die Datei in meinem Editor geöffnet wird.</p>
<p>hat einer eine Idee wie man das im C++ Builder realisiern koennte?</p>
<p>Der Text eingabe bereich ist vom Typ RichEdit!</p>
<p>Hier is der Code des Programms was ich bis jetzt hab:</p>
<pre><code>//---------------------------------------------------------------------------
#include &lt;vcl\vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
#include &quot;Unit2.h&quot;
//---------------------------------------------------------------------------
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
txtfield-&gt;Clear();

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormResize(TObject *Sender)
{
txtfield-&gt;Width = Form1-&gt;ClientWidth;
txtfield-&gt;Height = Form1-&gt;ClientHeight;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Neu1Click(TObject *Sender)
{
txtfield-&gt;Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Speichernunter1Click(TObject *Sender)
{
   if (SaveDialog1-&gt;Execute() == true)
   {
       txtfield-&gt;Lines-&gt;SaveToFile(SaveDialog1-&gt;FileName);
   }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::oeffnenClick(TObject *Sender)
{
 if (OpenDialog1-&gt;Execute() == true)
    {
       txtfield-&gt;Lines-&gt;LoadFromFile(OpenDialog1-&gt;FileName);
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::druckenClick(TObject *Sender)
{
  if (PrintDialog1-&gt;Execute() == true)
    {
//       txtfield-&gt;Lines-&gt;PrintToFile(PrintDialog1-&gt;txtfield);
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &amp;CanClose)
{

switch (Form2-&gt;ShowModal() )
    {
    case mrYes: CanClose = true;
      if (SaveDialog1-&gt;Execute() == true)
       {
          txtfield-&gt;Lines-&gt;SaveToFile(SaveDialog1-&gt;FileName);
       };
    break;
    case mrNo: CanClose = true; break;
    case mrCancel: CanClose = false; break;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ausschneidenClick(TObject *Sender)
{
txtfield-&gt;CutToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Kopieren1Click(TObject *Sender)
{
txtfield-&gt;CopyToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Ein1Click(TObject *Sender)
{
txtfield-&gt;PasteFromClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::loeshcenClick(TObject *Sender)
{
txtfield-&gt;ClearSelection();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FindDialog1Find(TObject *Sender)
{
 	for (int I = 0; I &lt; txtfield-&gt;Lines-&gt;Count; I++)
    {
     int PosReturn = txtfield-&gt;Lines-&gt;Strings[I].Pos(FindDialog1-&gt;FindText);
     	if (PosReturn) {
        	int Skipchars = 0;
            for (int J = 0; J &lt; I; J++)
            	Skipchars += txtfield-&gt;Lines-&gt;Strings[J].Length();
            Skipchars += I*2;
            Skipchars += PosReturn - 1;
            txtfield-&gt;SetFocus();
            txtfield-&gt;SelStart = Skipchars;
            txtfield-&gt;SelLength = FindDialog1-&gt;FindText.Length();
            break;
        }
     }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N1Click(TObject *Sender)
{
 if (FindDialog1-&gt;Execute() == true)
    {

    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ErsetzenClick(TObject *Sender)
{
  if (ReplaceDialog1-&gt;Execute() == true)
    {

    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ReplaceDialog1Replace(TObject *Sender)
{
for (int I = 0; I &lt; txtfield-&gt;Lines-&gt;Count; I++)
    {
     int PosReturn = txtfield-&gt;Lines-&gt;Strings[I].Pos(ReplaceDialog1-&gt;ReplaceText);
     	if (PosReturn) {
        	int Skip = 0;
            for (int K = 0; K &lt; I; K++)
            	Skipchars += txtfield-&gt;Lines-&gt;Strings[K].Length();
            Skip += I*2;
            Skip += PosReturn - 1;
            txtfield-&gt;SetFocus();
            txtfield-&gt;SelStart = Skip;
            txtfield-&gt;SelLength = ReplaceDialog1-&gt;ReplaceText.Length();
            break;
        }
     }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ReplaceDialog1Find(TObject *Sender)
{
for (int E = 0; E &lt; txtfield-&gt;Lines-&gt;Count; E++)
    {
     int wiedergabe = txtfield-&gt;Lines-&gt;Strings[E].Pos(ReplaceDialog1-&gt;FindText);
     	if (wiedergabe) {
        	int Skip = 0;
            for (int T = 0; T &lt; E; T++)
            	Skip += txtfield-&gt;Lines-&gt;Strings[T].Length();
            Skip += E*2;
            Skip += wiedergabe - 1;
            txtfield-&gt;SetFocus();
            txtfield-&gt;SelStart = Skip;
            txtfield-&gt;SelLength = ReplaceDialog1-&gt;FindText.Length();
            break;
        }
     }
}
</code></pre>
<p>Ich hab da noch ein Problem beim Drucken ich kann zwar den PrintDialog aufrufen aber ich weiss nicht wie ich ihm sagen soll was er ausdrucken soll.</p>
<p>Beim Suchen und Ersetzen sind auch noch en Paar fehler:</p>
<p>Suchen: Wenn ich weiter suchen drücke bleibt er beim ersten gesuchten wort</p>
<p>Ersetzen: Er findet zwar das wort aber ersetzt es nicht.</p>
<p>kann mir da jemand helfen?</p>
<p>danke im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946807</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946807</guid><dc:creator><![CDATA[Kaneda]]></dc:creator><pubDate>Wed, 21 Dec 2005 08:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 08:41:20 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=4180" rel="nofollow">Korbinian</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=11" rel="nofollow">Projekte</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=2" rel="nofollow">VCL/CLX (Borland C++ Builder)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/946815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946815</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 21 Dec 2005 08:41:20 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 09:51:30 GMT]]></title><description><![CDATA[<p>schau dir doch mal die hilfe des builders an</p>
<p>besonders TReplaceDialog und OnReplace-Ereigniss!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946859</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Wed, 21 Dec 2005 09:51:30 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 10:24:40 GMT]]></title><description><![CDATA[<p>Kaneda schrieb:</p>
<blockquote>
<p>Er soll die eigenschaft besitzen das man z.B. eine Text Datei vom Desktop nimmt und diese dann in die Textbox des Programms zieht und somit die Datei in meinem Editor geöffnet wird.</p>
</blockquote>
<p>Hierzu empfehle ich extensive Studien der BCB-FAQ (siehe gepinnter Thread in diesem forum)<br />
Desweiteren empfehle ich die Verwendung des <a href="http://www.junix.ch/bcb/help/" rel="nofollow">Document/view-Prinzips</a> für den Editor...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946887</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946887</guid><dc:creator><![CDATA[junix]]></dc:creator><pubDate>Wed, 21 Dec 2005 10:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 11:04:46 GMT]]></title><description><![CDATA[<p>ser1al schrieb:</p>
<blockquote>
<p>schau dir doch mal die hilfe des builders an</p>
<p>besonders TReplaceDialog und OnReplace-Ereigniss!</p>
</blockquote>
<p>hab mir das schon inner hilfe angeguckt hilft mir aber auch net so ganz weiter.</p>
<p>mit Replacedialog rufe ich ja dieses:<br />
<a href="http://img371.imageshack.us/img371/9144/ersetzen3rv.jpg" rel="nofollow">http://img371.imageshack.us/img371/9144/ersetzen3rv.jpg</a> Fenster auf.</p>
<p>aber ich weiss nicht wie ich das Feld &quot;Ersetzen mit&quot; anspreche, damit er das gesuchte Markierte Wort ersetzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946926</guid><dc:creator><![CDATA[Kaneda]]></dc:creator><pubDate>Wed, 21 Dec 2005 11:04:46 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 12:34:09 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>siehe die Eigenschaft <em>TReplaceDialog::ReplaceText</em> in der BCB-Hilfe.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/946988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/946988</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Wed, 21 Dec 2005 12:34:09 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 21 Dec 2005 12:46:43 GMT]]></title><description><![CDATA[<p>Wenn PrintDialog ausgeführt wird, dann soll der Inhalt des Richedit gedruckt werden.</p>
<pre><code>if (PrintDialog1-&gt;Execute())
  {
  Form1-&gt;RichEdit1-&gt;Print(Form1-&gt;Caption);
  }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/947002</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/947002</guid><dc:creator><![CDATA[tom883]]></dc:creator><pubDate>Wed, 21 Dec 2005 12:46:43 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 04 Jan 2006 16:31:15 GMT]]></title><description><![CDATA[<p>jo danke fuer die hilfe bin schon einiges weitergekommen....</p>
<p>nur das mit dem drucken und mit dem replace klappt net so ganz kann mir da einer helfen?</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/956855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/956855</guid><dc:creator><![CDATA[Kaneda]]></dc:creator><pubDate>Wed, 04 Jan 2006 16:31:15 GMT</pubDate></item><item><title><![CDATA[Reply to Projekt: Text Editor on Wed, 04 Jan 2006 16:40:03 GMT]]></title><description><![CDATA[<p>Drucken:</p>
<p><a href="http://www.marquardtnet.info/cecke/quickies.1/1_quicky_30.html" rel="nofollow">http://www.marquardtnet.info/cecke/quickies.1/1_quicky_30.html</a></p>
<p>Das könnte Grundlage sein</p>
]]></description><link>https://www.c-plusplus.net/forum/post/956873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/956873</guid><dc:creator><![CDATA[Christian211]]></dc:creator><pubDate>Wed, 04 Jan 2006 16:40:03 GMT</pubDate></item></channel></rss>