Your First App
Hello World

This document will try to walk you through a set of steps that will let you create you first TCB program. The Hello World exercise is a typical first learning example in many computer programming languages. It will require TCB documentation. You need TCBPrcs.htm and TCBfunctions.htm located in the .\docs folder. They should already already be displayed along with this document.

If the documents are displayed in the TCB document browser, you should click the On Top selection in the menu bar so you can see other documents. The document browser is designed to pop-up documents for a user to browse and then be closed as soon as pertinent information has been digested.

Getting Started

First, we are going to use Windows Explorer (we are running Windows, right?). So open Windows Explorer and find the application folder containing TCB. This will make it easier to do what you are about to do.

TCB runs programs from a set of specifications. A TCB program specification set is an electronic sheet that can be stored in a text file or as a database record. The program specification contains one-line descriptors for the program window and each object to used placed in the in the window. A valid TCB program must contain at least one window specification and at least one tangible object specification.

Each specification line consists of a set of properties for an object separated by commas. If info has an imbedded comma, the entry must be surrounded by double-quotes. Look at the document, TCBPrcs.htm. Scroll down to the caption titled, TCB programs. Below that is a line that begins with, winspec=. Note that this is a window specification line. Below that line is another winspec= line. This line serves as a template prototype for the window specification. This the general format for object descriptions that follow.

Let's Begin

Place your mouse cursor in the TCB folder, right-click and select New then select Text Document. Rename the document to "helloworld.txt." Now click, double-click or otherwise open the document in Notepad or any text editor of your choice.

Now, copy and paste the first winspec= line in the document TCBPrcs.htm into the helloworld.txt document. Scroll down to the first butnspec= line in the document TCBPrcs.htm and copy and paste that line into the hellowworld.txt document. Scroll down to the first lblspec= line and copy and paste that line into the hellowworld.txt document. Change the text Reports in the lblspec= line to "Hello World." Change the text 12 to "16" and the text 300 to "400." Go to the helloworld.txt document , use the File menu and select Save.

Congratulations

You have just created a valid TCB program! What, you don't believe? In the TCB folder, select the helloworld.txt file and drag it to the executable, xmenu.exe, and release the cursor.

There it is. The window you see is empty except for a little gray button in the upper left-hand corner of the screen, a label captioned "Hello World," and a label at the bottom of the screen. You put the button and the hello world label there. The copyright label is standard issue but there is a function to modify it.

More

Let's make your program a little more interesting. Add a a line containing iggall to the program. Now we will add another object. Scroll down to the first imgspec= line in TCBprcs.htm and cut and paste that line into the helloworld.txt document. Replace the text prcs\real.prc with this text, "helloworld.txt."

Now save your file but before we continue we have a minor problem. The helloworld.txt program screen is still there and there is no visible way to close it. Program designers have COMPLETE control of the program window. In this case there is an out. Remember the gray button. It is programmed to call a special function. When you click it, a row of colored buttons appear near left, bottom edge of the window.

These buttons control the behavior of the window. Click the reddish button to close the window. This function does much more than control the window but that is beyond this discussion and is referenced elsewhere as the prototyping function. The prototyping function only works with tcb.exe.

We now have 4 specifications in the program. Drop the helloworld.txt program on tcb.exe and note the changes. The window has background image now and the contrast is much better. The image button we added exposes a method we call the IDE button. IDE means "integrated development environment." IDE's are use by systems professionals to develop computer programming code in a visual, self-contained environment or set of windows. Click the button now. It reloads the program. Right-clicking the button lets the program be edited with Notepad. Right-click it now then close the notepad window that appears since we are already editing the program.

A Little More

We will add a text object to the program. Scroll down to the first txtspec= line in TCBprcs.htm and cut and paste that line into the helloworld.txt document. OK, lets fix this text box up a little.

In the txtspec= line, change the text yellow in the txtspec= line to "cornsilk." Change the text black to "teal." Change 2480 to "4000." Change 3675 to "1500." Change 3675 to "800." Change 4730 to "5000." Click the IDE button.

Specifications also include flags and switches that modify the functioning of the program window and program behavior. Scroll up to the caption TCB program Flags then down to the dateon= line. Simply add a new line with just dateon= in it and save the files. Click the IDE button. Note that a date time display appears in the top-right of the window. Now the color of the text is the same as the copyright at the bottom. These objects get there color from the winspec= spec. Change the text Plum to "green." Click the IDE button.

There are other kinds of program specifications we are only going to show one more. It will show the use of the prespec= specification and a function to put data in the text box. Copy and pastes the following text into a new line in hellowworld.txt:
prespec=textclr=1|textin=1;docs\masterlicense.txt|
Save the file and click the IDE button

Conclusion

You have a nice program that can do useful work. Just by adding a few more buttons, the program can easily be turned into a general text file browser and editor.

While anyone can use TCB, people with experience in designing or programming applications would be the quickest learners of TCB. Serious solution designers will read all the documentation, admittedly sparse and incomplete, and "play" with some of the almost 100 programs available to learn from them. There are examples that demonstrate all the objects and functions available. There are several programs that act as tutors.

The most effortless way to create a program you are interested in is to choose one or more programs that do some of what you want and modify them. That is also the fastest way of learning TCB functions and how to apply them.

All the programs you find in this distribution are Works In Progress. So you will find that many programs have an IDE button or other structures that aid in system development. No program is required to do anything. Its totally up to you to instruct TCB what to do by the programs you feed it.












Copyright © 1982-2016 Phoenix Information Systems/TM all rights reserved
Contact: Fred Pierce, makpiya@aol.com, makpiya@gmail.com, 831-240-9969