Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
494 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (5)


Un-hiding PropertiesGo to Romeo Lefter's websiteFormat this article printer-friendly!Bookmark function is only available for registered users!
Little hacking inside VCL
Product:
Delphi all versions
Category:
Component Writing
Skill Level:
Scoring:
Last Update:
03/21/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet VCL component properties
Times Scored:
5
Visits:
2721
Uploader: Romeo Lefter
Company: Rombest Software
Reference: N/A
 
Question/Problem/Abstract:
Unhiding some usefull properties for VCL controls.
Answer:



I have wrote this article because I'm shure that there are many developers that encounters the same problems like me.
In example, I have stayed many time to align a editbox. Or a Button. In my opinion, the best way to align controls is using the Align property. But how? If you are looking on Object Inspector, you will see that for edits, checkboxes or some other controls, the Align property is missing.

Looking inside VCL source, you will observe that the ancestor of TEdit is TCusomEdit and the ancestor of TCustomEdit is TWinControl. TWinControl has fully implemented the align property! Wow! This is cool because that means that we can create easy and fast a Edit control with Align property. So let's do the work. From "Component" menu choose NewComponent and, in the opened dialog set as AncestorType TEdit. Fill the remaining properties and then press Install. A new component, derived from TEdit, is now on the component pallete. Open it's unit and in the published area add the align property like bellow.

{ Public declarations }
published
{ Published declarations }
property Align;
............

Now recompile your package and... AMAZING! You have the align property for your TEdit. Good Work!

The same action you can do with TDbEdit, TSpeedButton. In fact, you can use the Align property with any VCL component thats not has this property implemented.

Now let's make another little hacking inside buttons. Create a TButton descendant and add in the published area the Brush and BorderWidth properties. Cool. Now you have a button with border. Do you want it with bevel? Just add the BevelKind, BevelInner and BevelOuter properties and now your button has a new look. Little more cool...
As a test of new look edit box, activate bevels and BorderWidth for it, set the CTL3d property to false and the BevelKind property to bkSoft. It's look different, isn't it?

From this point, the action is in your hand. I have descibed you the way. VCL has many other "hidden" properties. If you find more, add your "discovery" as a comment to this article.





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Button
    Kay (Jul 24 2002 4:29PM)

I tried to create my own button, but i can't change the bevels, therefore I saw them in the Object Inspector
Respond

typecast
    Eber Irigoyen (Mar 22 2002 5:51PM)

...unless you are gonna use your "new component" a lot, you can just type cast to access ancestors properties, like:

TWinControl(Edit1).Align:=alTop
Respond

Little suggestion
    Daniel Wischnewski (Mar 21 2002 11:53AM)

You should not change the orignal components but rather create descendents. This will allow for easier updates and future upgrades. You could add them to your standard palette and hide the old ones.
Respond

RE: Little suggestion
Romeo Lefter (Mar 21 2002 12:36PM)

I haven't say to modify components. I have said to create descendants :)
Respond

RE: RE: Little suggestion
Daniel Wischnewski (Mar 21 2002 1:01PM)

Sorry, I missed it - didn't say anything.

Regards,
Daniel
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
Hans Gulö
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)