Graphical C++ – Introduction (incomplete)

About Graphical C++:

here are many different implementations are possible through Turbo C and C++. Graphics programming is one of them. After a long time when I wrote different graphics programs through C, a question in my mind is always there that, are not we implement any user-friendly programs by which, any programmer can develop GUI (Graphical User Interface) software in DOS? At that time I tried to complete a total solution of this. Thank God. I am able to do this job successfully.

Yes. I have completed a great source code package by which the GUI applications in DOS become easiest. And this is The “Graphical C++”.

The “Graphical” part refers to the GUI type of program, that you can write with the help of Graphical C++ to create GUI applications and software. And the “C++” part refers to the programming language by which the program was and can be implemented.

          So, in one sentence, this is a complete source to develop GUI applications very easily rather than writing numerous lines of codes to design the graphical objects.

Like many other GUI languages such as Visual Basic or .NET, Graphical C++ provides many inbuilt graphical objects. They are Forms, Labels, Text Boxes, Combo Boxes, Message Boxes, List Boxes, Command Buttons, Check Boxes, Input Boxes, Frames, Menus and many more.

It contains above 7500 lines of source code, over 50 different graphical objects and over 150 of useful functions.

          You can just simply use them by writing just about 5 to 10 lines of programs. I think that it is now clear to you what Graphical C++ is?

About this book:

This book is all about Graphical C++. Here I am trying to clear the total use of Graphical C++ package with syntaxes and use of all the components are presented here. This is the first time I have released this book. So please pardon any error or mistake from me. Thank you.

Getting Stated:

At first you have to copy two files “GCPPFUNC.H” and “GCPPMAIN.H” of Graphical C++ from the source CD to your turbo C folder. You have to copy these two files in the same directory. For example “c:\tc” directory. Otherwise you can declare the path name when you use them. When you start any program, just include only “gcppmain.h” file because the file “gcppfunc.h” is already include there in “gcppmain.h”.

          Here I discuss about all the objects of my Graphical C++.

Objects or Controls of Graphical C++:

If any reader of this book know Visual Basic, it is easy to him/her to know about those controls. Because these controls are vary similar to the Visual Basic’s controls.

Form Control

As I said earlier, the form idea and design of my form control is very similar to Visual Basic’s form. What mainly you see in the windows is a form. For example, when you right click on the desktop and choose “properties”, it opens properties dialogue box. This is a form. On the other hand, you use Microsoft Word. It is also a form with other forms. They are different in types. So, the first step of any windows based or GUI programming is to create or use forms.

          In Graphical C++, I create an object called “Form” which has the same body color (gray) as other windows forms have, a title bar with a title, a close button and totally with 3D appearance.

          You can set the title (caption) of the title bar, can change the body or title bar or title colors. You can close the form by clicking mouse on the close button. You can hide the form without affecting the background contains of it presented on the screen.

For this task, you have to use the procedures or the properties of the form controls. Here I give all of them: –

Form Declaration:

To declare a Form in your project, just create an instance of the Form Class by writing such code:

                   Form form1;

You can declare many form at a time as I declare here:

          Form form1,form2,f1,f2;

Here Form is the “Form class” & form1, form2, f1, f2 are all Form class’s objects or instances.

Properties, Procedures & Functions of Form Object:

Caption: By using this property, you can set the title of the form. By default a form set its caption “GCPPForm”. But when you set this property it will change.

          Syntax: <Form object>.Caption(“your caption”);

          Example: form1.Caption(“Graphical C++”);

Show:  To show a form, you have to use this procedure. There are two procedures with same name. But they take different arguments when called. Here are the syntaxes of the twos.

Syntax 1: <Form object>.Show(left, top, right, bottom co-ordinates, file name)

Syntax 2: <Form object>.Show(left, top, right, bottom co-ordinates, caption, file name)

You can simply notice that the difference between this two is that the second procedure takes just “caption” argument extra.

That means, if you use the second procedure, you don’t have to set the Caption property differently.

Example 1: form1.Show(100,100,getmaxx()-100,getmaxy()-100, “imagefile.dat”);

Example 1: form1.Show(100,100,getmaxx()-100,getmaxy()-100, “Graphical c++”,“imagefile.dat”);

Hide: To hide a form, you have to use this procedure. It is very simple and easy to use. You just call the Hide() procedure when you want to and it will hide the correspondent form of it.

          Syntax: <Form object>.Hide();

          Example: form1.Hide();

Close: To close a form, use it. It means that when you call this procedure, it will ask the mouse to click on the close button of the correspondent form. If you click on it, it will automatically close. But if you don’ t click there and strike any key from the keyboard, the procedure must be end without closing the form. The syntax and use of it is same as Hide proceure.

          Syntax: <Form object>.Close();

          Example: form1.Close();

Backcolor: This property is used to change the body color of the form. By default it set as gray. You can set up to 15 colors as DOS and graphics programs on Turbo C supports.

          Syntax: <Form object>.Backcolor(color);

          Example: form1.Backcolor(RED);

Barcolor: This property is used to change the title bar color of the form. By default it is Blue. You can change them as I said earlier in “Backcolor” area.

          Syntax: <Form object>.Barcolor(color);

          Example: form1.Barcolor(RED);

Capcolor: This property is used to change the caption color of the form. By default it is White. You can change color as Back & Bar Color.

          Syntax: <Form object>.Capcolor(color);

          Example: form1.Capcolor(RED);

Appearance: It is also same as VB. Here I set two appearance style for forms. One is “Flat” & another is “3D”. That means, if you choose flat then the form will appear just as a rectangle. But if you choose 3D, then it will appear as general forms. Set the appearance property as 0 for flat and 1 for 3D.

 

            Syntax: <Form object>.Appearance(property (0 or 1);

          Example 1: form1. Appearance(0); //for Flat

          Example 2: form1. Appearance(1); //for 3D

Clickclose: This Function will close the current form when you click on the “close” button of this form by mouse.

          Syntax: <Form object>.Clickclose();

          Example: form1.Clickclose();

          NOTE: On success return 1. If failed, return –1.

Keypressclose: This Function will close this form by pressing “Alt+F4” button combination as we close any running applications in Window by pressing this combination keys.

Syntax: <Form object>.Keypressclose();

          Example: form1.Keypressclose();

          NOTE: On success return 1. If failed, return –1.

NOTE: you have to set all color and appearance properties before “Show” procedure.

✍️ Leave a Comment

Your email address will not be published. Required fields are marked *