Class TThreeDPanel (unit T3dpanel)

Inherits from

TPanel

Author : John Wilson Version 1.4 Date : January '97 This component is freeware and must be treated as such, i.e. no liability for any damage of any kind will be accepted by me. It was written when I was first starting to understand VCL's and how they worked (as you can se by the number of comments in the code) You can look at this component as a beginner's guide to modifying existing components :-). This component is a descendant of TPanel, similar to the buttons found in MSIE which become raised when the mouse moves over them. There are a couple of new added properties. ClickColor : The color the panel changes to when you click on it (I adjusted the OnMouseDown) ResetColor : The color that the panel changes (or reverts to) when "unclicked" (Modified OnMouseUp) ResetBevel : The way the bevel changes when the mouse is moved off the panel. This is actually determined by where the cursor is ( found by the function getcursorpos() ) generally as the mouse moves off the inner bevel on the way out of the component (thickish bevels are recommended (4-5 pixels). ToInnerBevel : Inner bevel that it is changed to when the mouse moves over it. *************** New Additions: *************** FocusColor : The colour that the panel caption changes to when the mouse moves over the panel. i.e. when the panel gets "Focus" UnFocusColour : The colour that the panel caption returns to when the mouse moves off it. This component will install as a 3DPanel on a tab named "Visuals". If you want to change this, go right ahead :). As a small (and simple) example, 1. drop the 3dpanel on a form (make it quite big), set the bevelwidth to 10 2. Set OuterBevel to bvRaised 3. Set InnerBevel to bvLowered 4. Set Clickcolor to clAqua 5. Leave ResetColor alone for now 6. Set ToInnner Bevel to bvNone 7. Set ResetBevel to bvLowered. 8. Set FocusColor to clBlue, set UnfocusColor to clWindowText 9. Run the program, move the mouse over the panel, you will see it raise itself to a platform looking thing, with the caption color changing. Move the mouse off it and it will return to it's previous state. Click on it as well. Nifty eh ? It starts to look really cool when you pile a lot of them on top of each other in pyramid fashion. If you have any other ideas or modifications you would like to make, please, go ahead, feel free. I really would appreciate it though if you would please let me have a copy of the source so that I can see what you did, and who knows, maybe have an improvment on yours :-). Thank you for trying out this component, play with it, experiment with it and above all HAVE FUN ! That's what Delphi is all about...... John email : badkarma@pixie.co.za

Constructors


constructor Create(AOwner: TComponent);

Protected declarations } {standard make it and then and break it calls

change 'Visuals' to whatever you like to put it on another page



Functions

destructor destroy ;


procedure resetbevelinner(value : tpanelbevel);

for drawing stuff, if you don't know what this is yet, go and read up on it, this line doesn nothing at the moment.

procedure resetoldcolor(value : TColor);


procedure setbevelinner(value : tpanelbevel);

invalidate calls the paint method, i.

procedure setbevelouter(value : tpanelbevel);


procedure setclickcolor(value : TColor);


Properties

property ClickColor : TColor


property FocusColor : TColor

new properties

property ResetBevel : TpanelBevel


property ResetColor : Tcolor


property ToInnerBevel : TPanelBevel

Published declarations } "property" places the property to be modified in the object inspector, remeber that events are properties too.

property UnFocusColor : TColor


Events

Variables

fbevelinner : TPanelBevel;

Private declarations

fbevelouter : TPanelBevel;


fclickcolor : TColor;


fcolor : TColor;


ffocuscolor : TColor;


fResetBevel : TPanelBevel;


fresetcolor : TColor;


funfocuscolor : TColor;



Constructors


constructor Create(AOwner: TComponent);

Protected declarations } {standard make it and then and break it calls

change 'Visuals' to whatever you like to put it on another page


Functions


destructor destroy ;


procedure resetbevelinner(value : tpanelbevel);

for drawing stuff, if you don't know what this is yet, go and read up on it, this line doesn nothing at the moment. Just in case you want to draw anything on the panel, like polka dots or tartan things :)


procedure resetoldcolor(value : TColor);


procedure setbevelinner(value : tpanelbevel);

invalidate calls the paint method, i.e. makes the "window" (3dPanel in this case) "invalid" or "damaged" and forces windows to repaint the control (with a windows message "WM_PAINT"). Since all of Windows is a huge game of "Simon says", this forces the panel to be updated. When it does this, you see the control being modified on the form. (Here the panel is repainted when the mouse moves off it.


procedure setbevelouter(value : tpanelbevel);


procedure setclickcolor(value : TColor);


Properties


property ClickColor : TColor


property FocusColor : TColor

new properties


property ResetBevel : TpanelBevel


property ResetColor : Tcolor


property ToInnerBevel : TPanelBevel

Published declarations } "property" places the property to be modified in the object inspector, remeber that events are properties too. } { property OuterBevel : TPanelBevel read fbevelouter write setbevelouter;} {left this here in case you want to play with the outer bevel as well


property UnFocusColor : TColor


Events


Variables


fbevelinner : TPanelBevel;

Private declarations


fbevelouter : TPanelBevel;


fclickcolor : TColor;


fcolor : TColor;


ffocuscolor : TColor;


fResetBevel : TPanelBevel;


fresetcolor : TColor;


funfocuscolor : TColor;