C + + Builder writing text editor

Source: Internet
Author: User

CB is another common client/server architecture development tool developed by Borland Company after Delphi. C++builder integrated development Bad environment in addition to in-depth more WINDOWS95 control components, can be established in more detail of the object classification, added many of the parts that do not have Delphi, C++builder interface is basically the same as Dhlphi. C++builder uses the C + + language instead of the Object Pascal language, so it can produce faster and more efficient code.

I've learned and used Foxbase, Visual FoxPro, C, Borland C + +, Visual Basic, and Visual C + +, but there's never been a programming language like CB that impressed me so much, I'll introduce you to C + + Builder writes a text editor that functions like a Windows Notepad, hoping to bring you into the fun C++builder world.

The object attribute values in this program are described below:

Object Class Property property value

  TMEMO NAME edit
   TBUTTON NAME bopen
   CAPTION “open”
   NAME bsave
   CAPTION “save”
   NAME bexit
   CAPTION “exit”
   TopenDialog NAME opendialog
   TsaveDialog NAME savedialog

The source code is as follows:

//--------
#include
#pragma hdrstop
#include "Unit1.h"
#pragma resource "*.DFM"
Tfo RM1 *form1;  
_fastcall Tform1::tform1 (tcomponent * owner)
: Tform (owner)
{
}
//-------above automatically generated by computer---
void _fastcall tform1::formcreate (tobject *sender)
{
bsave->enabled=false;//Set the SAVE key to invalid
Edit->l Ines->clear (); Clear the contents of edit
edit->enabled=false;//Set Edit to invalid

//------above is the initial content of the form when it was established----
void _fastcall Tform1: : Bopenclick (TObject *sender)
{
if (edit->modified)/If the text in edit has been changed but not saved, pop-up dialog box asking if you want to save the
{yn= Application->messagebox ("File has been modified, do you want to save it?") "," opened ", mb_yesno| Mb_iconquestion);
if (yn==idyes) edit->lines->savetofile (savedialog->filename);  
}
Edit->enabled=true;
if (Opendialog->execute ()) edit->lines->loadfromfile (opendialog->filename);
edit->modified=false;
bsave->enabled=false;
}
//------above is the process of opening a file button--
void _fastcall Tform1::bsaveclick (tobject *sender)
{
if (Savedialog->execute ()) edit->lines-& Gt SaveToFile (Savedialog->filename);
edit->modified=false;
bsave->enabled=false;
}
//------above is the procedure for saving a file button-
void _fastcall tform1::editchange (tobject *sender)
{
Bsave-> ; Enabled=true;   
}
//---------------------
void _fastcall tform1::bexitclick (tobject *sender)
{
Close ();
}

The above test passes in the c++builder3.0.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.