TAbout

written by: lore
email: lore at newty dot de
home: www.newty.de
last updated: 25.07.00

Download Example Project

Overview

About-Dialog with a few lines of text and an animated icon playing pinball with the dialogīs frame. Shows how to move an icon without flickering.

Details

Despite its name, the class is a derived from TWindow. It owns a few static text-fields and a child-window in which the icon is diplayed. This construction prevents flickering. When you just move an icon it would flicker due to instant re-paints. You donīt have this problem when you display it at a fixed position in a child-window and move this child-window arround.

Important Functions

TAbout(TWindow* parent, const char* title, const TFont* font)

Constructor: parent and title should be clear. font is a pointer to a TFont-object and this font is used for the static text-fields.

setText(int row, const char* text);

This function is used to set the texts of the static text-fields. row indicates the text-field. Valid values are from 1 to 4.

How to Use

The following code is an excerpt from the projectīs file main.cpp and shows how to instantiate and create an TAbout-Dialog. There is only one function CmAbout() which is called when the user hits the menu-item About.

   /****************************************************/
   //
   //  usage of about-dialog TAbout
   //


#include "about.h"


/***********************************************************************************************************/
// display about dialog
void mainWnd::CmAbout()
{
   TAbout* about = new TAbout(this, "About the program", font);         // new dialog and ...
   about->Create();                                                     // ... create it

   // set the static text-fields of the dialog
   char szText[256];
   sprintf(szText, "%s    - powered by Borland c++ 5.02", prgName);
   about->setText(1, szText);
   about->setText(2, "testbed for TThreadCtrlDlg, TAsciiData and TAbout");
   about->setText(3, "written by lore at newty dot de");
   about->setText(4, "free for all kinds of non-commercial use");

   about->SetFlag(wfDeleteOnClose);    // set flag: dialog is deleted, when it is closed
}
Download Example Project