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.