home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 September
/
Chip_2001-09_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d123456
/
DFS.ZIP
/
DFSSplitter.txt
< prev
next >
Wrap
Text File
|
2001-06-28
|
12KB
|
199 lines
TdfsSplitter v2.03
Description:
A descendant of the TSplitter component (D3, C3, & D4) that adds a
"maximize - restore" button. This mimics the behavior of the splitter in
Netscape Communicator v4.5. Clicking the button moves the splitter to its
farthest extreme. Clicking again returns it to the last position.
Contact Information:
The lateset version will always be available on the web at:
http://www.delphifreestuff.com
If you have any questions, comments or suggestions, please use the Delphi
Free Stuff Support Forum at:
http://www.delphifreestuff.com/discus/
If, for some reason, you can not use the web-based support forum, you can
email me at bstowers@delphifreestuff.com. However, the support forum will
always take precedence over direct email since it provides a resource that
others can use when they have a problem. Every message posted to the forum
is emailed directly to this account, so emailing me directly will not get
your message to me any faster. It will only make the message less important
for me to respond to since only one person (you) is benefiting from it
instead of everyone interested. Having said all that, please do email me
directly if it is regarding something that isn't really support related,
i.e. just to say thanks (as novel as that idea is).
Installation:
Delphi 1, Delphi 2, C++Builder 1:
* This component is not compatible with Delphi 1, 2, or C++Builder 1.
Delphi 3, 4, 5, C++Builder 3 & 4:
* Do one of the following:
+ Create a new package by selecting File | New and choosing Package from
the New tab in the dialog.
+ Open an existing package file. I suggest you do this if you already
have a package that you like to use for small, third party components.
I specifically have a package named "3rdParty.dpk" that I use for
small components that come from other people. Or, if you are using
several of my components, you might create a "DFS.dpk" package and
use it for all of my DFS components.
* In the resulting package window, click the Add button.
* In the Add dialog, on the Add Unit tab, enter the full path name of the
component's registration unit (the unit that ends with 'Reg.pas', i.e.
'BrowseDrReg.pas') and click OK.
* You may want to add the other source files (*.pas) to the package as
well in the same manner as you did the registration unit. While this is
not required, not doing it will cause compiler warnings when the package
is compiled. The component will function fine either way, but I
personally find the warnings very irritating and am not happy until
every compiler warning and hint is gone.
* If this package is new, or it has never been installed, click the
Install button in the package window. If this package is already
installed in Delphi, click the Compile button.
C++Builder 5 and up:
* Perform the "Delphi 3 and up, C++Builder 3 and up" steps above, except
for the last step (Compile or Install).
* Select the package the component has been added to, and choose
Project | Edit Option Source to open the package options in the editor.
* In the entry for PFLAGS, add the "-LUvcl50" option. For example:
<PFLAGS value="-$YD -$W -$O -v -JPHNE -M -LUvcl50"/>
* Perform the final step from above, Compile or Install.
* For Borland's official word on this situation, open the C++Builder help
file and search the index for "dsgnintf.dcu" and see the "Compiling
packages with DsgnIntf" section.
Delphi 6 and up:
* Perform the "Delphi 3, 4, 5, C++Builder 3 & 4" steps above, except
for the last step (Compile or Install).
* Add the DesignIDE package to the Requires list of the package into which
the component is being installed.
* Perform the final step from above, Compile or Install.
* This is necessary because of changes to the design-time support units
introduced in Delphi 6. For complete information, see the Del6New.hlp
file in your Delphi 6 Help directory. In the index, search for
"upgrade issues" and in the resulting list of topics, select the
"DsgnIntf renamed and related changes" topic.
Notes:
* If you like this Netscape style enhancement, you may also be interested in
the TdfsToolBar component on my web site.
* Button arrow directions follow the Align property. I tried with an
independent ButtonDirection property, but it turned out to be just to nasty
from both a coding and usage perspective.
* A possible future enhancement if there is any interest: The D4 version of
TSplitter has an OnPaint event. The button paint's after this fires, so you
can paint the bar without worrying about the button itself. It might be
nice to have an OnPaintButton event so that could be painted differently as
well.
Known Issues:
* The fix implemented here for the TSplitter bug may not work on all versions
of Delphi. It does work on Build 5.37 (from About box), but I've had one
other person tell me he has Build 5.33 and the DoCanResize method is not
protected virtual in that.
* I can't control when the OnMoved event fires, and the way TSplitter is set
up, it fires before the controls are actually moved in the maximize and
restore processes. So, do not rely on positions if you code only for the
OnMove event. The OnMaximize and OnRestore events do fire after the
controls have moved, so if you need that information, you can get it there.
* It is possible to get the direction arrows to paint outside of the button
if you use silly values (like a button width of 25 and height of 40). If
you're silly enough to do it, you're silly enough to like it. I don't
consider it worth the trouble to fix. If you can make a reasonable case
otherwise, send me email.
TdfsSplitter Revision History:
2.03 + Updated for Delphi 6 compatibility. See updated install directions
above.
2.02 + bsNetscape style wouldn't always minimize in the correct direction.
+ bsWindows style sometimes thought the close button was the
minimize button, and vice versa.
+ Updated for C++Builder 5 compatibility.
2.01 + Changed ordering of window buttons on vertically aligned bsWindows
style splitters. Close is now at the top, with maximize and
minimize following in that order. It seemed much more correct that
way.
2.00 + Added ButtonCursor property to control the cursor that is displayed
when the mouse is over a splitter button.
+ Fixed problem of bsNetscape style not minimizing in the right
direction for some alignments (bsNetscape was the only style in
previous versions).
+ Added a ButtonStyle property that offers a new style of splitter.
bsNetscape style makes the splitter behave as it always has.
bsWindows offers a new style where you can have window caption style
buttons (minimize, maximize, close). Minimize always moves the
splitter down for horizontal and left for vertical, and vice versa
for maximize. Added supporting properties for this new style:
WindowsButtons to specify which buttons are to be displayed;
OnMinimize event (bsNetscape always uses OnMaximize to simplify
things for you); OnClose event for close button click. Because the
component has no way of knowing what it should do for a "close" event,
it does nothing except fire OnClose. That event must do whatever it
deems necessary for a "close".
Many properties are now only used for bsNetscape style:
ArrowColor, AutoHighlightColor, ButtonColor, ButtonHighlightColor,
ButtonWidth, ButtonWidthType, TextureColor1 & 2 are never used for
bsWindows style. Buttons are always sized to be square based on
the available area, and are always draw in the same color as normal
caption buttons.
+ Made Minimized and Maximized properties published. Remember,
+ Splitter aligned right or bottom would not restore from maximized
position. The position would gradually increase each time.
1.10: + New property, AllowDrag, that indicates whether the splitter can be
moved by dragging with the mouse or not. If false, only the button
can be used.
+ Fixed problem where splitter could not be dragged back to the minimum
position just after it had been restored via the button.
+ The button arrow directions will now correctly update when dragging
the splitter to/from the minimum position. That is, in previous
versions, dragging to the min position would still leave the button
in the old state. Hard to explain, but in a nutshell it works like
Netscape now.
1.07: + It's *really* D5 compatible now. Small change between the D5 eval
version and the real, shipping D5 version broke it.
+ Added simple demo.
1.06: + Updated for Delphi 5 compatibility.
1.05: + Updated for C++Builder 4 compatibility.
1.04: + Enabled property added. Thanks to Bob Arnson for implementing and
sharing with us. If the splitter is not enabled, the button is not
shown and the cursor reverts to the default instead of a splitter.
+ Added DFSSplitterReg unit. All IDE specific code (i.e. registering
the component, property editors, etc.) are contained in this unit.
This was done for two primary reasons: 1) Using the component in a
Delphi or C++Builder expert would register the component as well.
2) Reduce code size in some cases -- usually the smart linker removes
this sort of stuff since the app never references it, but now it's
for certain since it isn't even in the unit. This change means that
you need to install the component using the new "registration" unit
instead of the unit containing the component.
1.03: + AutoHighlightColor property added by Ken Semerkant
(ksemerkant@usa.net). Setting this property to TRUE will calculate
the highlight color for the splitter button based on the user's
window caption system color.
1.02: + Clicking beside (but not right on) the button when it was in the
maximized state would cause it to lose it's maximized state.
+ Did the DoMaximize and DoRestore methods wrong. The OnMaximize and
OnRestore events didn't fire if you set Maximized property in code.
1.01: + Added RestorePos property to public declaraions. It is the position
that a maximized splitter will return to. It is useful for saving
and restoring the state of a splitter between sessions. Thanks to
Marcus Monning (info@mmsoftware.com) for this suggestion.
+ Fixed the nasty bug in D4 where TSplitter (not just TdfsSplitter)
could get "stuck" at one of it's extremes. Thanks again to Marcus
Monning for tracking this ExtCtrls.pas bug down.
+ Wasn't honoring the MOVEMENT_TOLERANCE value that's used to tell it
when a small move is considered really a move and when it is a button
click.
+ Certain conditions could cause the arrows to not be redrawn.
+ Cursor setting changed a bit to make it more like Netscape.
+ Marked Version property as not stored since it doesn't need to be.
It would only add to the size of your EXE, and that's silly.
1.00: + Initial release