|Submitted on: 7/9/2000 6:14:42 PM |
By 3 Users
Compatibility:Pre Delphi 4, Delphi 4, Delphi 5
Users have accessed this article 4298 times.
| Here is an example showing how to use the Component Template. You will find it under 'Component' on the Delphi menu.
Component Templates are very handy, yet very simple to use.|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
| irst start with a blank Form.
Add a Panel, and set Panel1.Align to alTop.
Drop 4 Button components on Panel1 in a row.
Put these names in the Buttons Captions:
In that order.
Next drop a StatusBar component on the Form, this should be aligned to alBottom.
Then drop a TMemo on the Form, and set its Align Property in the Object Inspector to alClient.
Next drop a OpenDialog component on the Form and a SaveDialog component.
Double-Click on the first Button, this is the Button with Open as its caption.
Then enter this code (the code between Begin & End;):
procedure TForm1.Button1Click2(Sender: TObject);
if OpenDialog1.Execute then
end;Double-Click on the second Button (The Save button) and enter this
procedure TForm1.Button2Click2(Sender: TObject);
if SaveDialog1.Execute then
end;Double-Click on the third Button and enter this code:
procedure TForm1.Button3Click2(Sender: TObject);
end;Double-Click on the forth button and add this code:
procedure TForm1.Button4Click2(Sender: TObject);
end;Click on the OpenDialog1 component and in the Object Inspector double-click on Filter, then put in this text:
All files *.*Do the same for the SaveDialog component.
Here comes the nifty part.
Go up to Edit in the Delphi menu and then
click on Select All then...
Click on Component in the Delphi file menu, then click on Create Component Template...
Type in the name you wish to use for the component template.
You can leave the Palette page name as Template.
And pick an icon for the new Template.
Click on OK and that's it.
Start a new project, go to the Template palette and click on your new component template.
Drop this on the Form and run the program.
And there you have it, an instant text editor.
You can set the StatusBar anyway you want.Just another amazing thing you can do with Borland's Delphi!
Other 31 submission(s) by this author
|Report Bad Submission|
See Voting Log |
|Other User Comments|
|7/21/2000 11:48:07 PM:Yvan Dumont|
Great man, i didn't know this!
|9/15/2000 4:58:16 PM:fdman|
| Add Your Feedback! |
|Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name. |
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here.