Print this
window
Installation instructions for:
TWFilterEdit.cpp
Purpose:
The TWFilterEdit component was created because I created a test and
attendance program for the Topeka Technical college in Topeka, KS. I needed to
limit the entry of characters into the edit boxes and this was the best way that
I found. The characters for most of the edit boxes were numbers, decimal
point and for the attendance edit box was AP*, and N. This component will have the same
attributes as the regular component, plus a few others that I thought
where needed:
1. Allow - What characters are allowed to be typed in the edit box.
2. Include - Do we limit the characters that are entered in the edit box.
The zip file includes the .cpp, .h, .res, and readme file. The .res file is the resource file that
will give the component its own image on the Palette page.
To install TWFilterEdit component:
There are two ways of installing the component: as is or by copying and pasting into your
own named component.
NOTE: Before installing the component please test it to make sure that it does what you
want it to do. I have found that it is a bit of a pain to get rid of one once you have
installed.
As Is:
Open the zip file into CBuilder5\Lib directory. All of the files must go into this directory.
Supposedly you do not have to place them in this location, but I have not had much luck with
placing them anywhere else.
Copying and pasting:
Open Builder 5, choose Component > New Component. Find the correct Ancestor type from the
drop down box, type in a Class name for the component. Please think up a good name for the
component. Select a Palette page or type one in and it will be created for you. You can then
either click on OK or install. If you are sure that this component is the one that you want
then click on install, else click OK. Now start copying and pasting from the downloaded file
to the new component.
To test the component:
Create a new project in the same directory that you placed the new component in and add the
component to the project by: Project > Add to Project and selecting the .cpp file.
Go to the constructor, FormCreate, or other method of your choosing and add this code. I have
done it in the constructor.
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TWFilterEdit *filterEdit = new TWFilterEdit(this);
filterEdit->Parent = this;
filterEdit->Left = 100;
filterEdit->Top = 200;
filterEdit->Height = 26;
filterEdit->Width = 100;
filterEdit->Visible = true;
filterEdit->Font->Size = 12;
filterEdit->Font->Style.Contains(fsBold);
filterEdit->Enabled = true;
filterEdit->Include = true;
filterEdit->Allow = "AP*N";
// Should call delete all on the component, called with the new operator
}
Run the program and type something into the edit box. The only allowable characters
are AP*, and N. This edit box is case sensitive as well.
To install the component:
Go to Components > Install Component
To place it into an existing package type in the path name to the component or click on
browse and locate the file. Click on OK. On the package form that comes up click on Compile
and then follow the instructions on the screen.
Take a look on the Palatte page and the new component should be located on the page that you
placed it on with the resource file that it is associated with.
If you have any problems with the component please contact me so I can straighten them out.
If you make any enhancements to the component please let me know so that I can share them
with everyone.
Thank you for choosing Widget Technologies.