home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 September
/
Chip_2001-09_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d123456
/
DFS.ZIP
/
DFSStickyForm.txt
< prev
next >
Wrap
Text File
|
2001-06-28
|
8KB
|
171 lines
TdfsStickyForm v1.00 Beta 2
Description:
A TForm descendent that makes the window behave like it wants to "stick" to
any edge of the screen, that is, when it comes within a certain number of
pixels of a screen edge, the window will jump to that edge.
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 1 is not supported.
Delphi 2, C++Builder 1:
* TdfsStickForm has not been tested on, and does not officially support
Delphi 2 or C++Builder 1. However, you should be able to simply place
the files in the directory of your choosing. There is no component
involved.
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.
Note that this will NOT add any items to your component palette.
TdfsDSAForm is not a component, but a TForm descendant class. So,
instead of a component palette icon, you will instead have a new "DFS"
tab added to the Object Repository (File | New). If you prefer a tab
name other than "DFS", you can edit the sStickyFormObjRepositoryPage
constant in DFSStickyFormReg.pas and recompile the package. Note that
you can use the name of an existing tab ("Forms" for example) to have the
items added there.
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.
Design-Time Access to TdfsStickyForm Properties:
NOTE: This information applies only to Delphi 3 and above, and C++Builder 3
and above. Previous versions of Delphi and C++Builder do NOT support
design-time access of TForm descendants. Sorry. You can should still
be able to use this class with those prior versions, you just won't
have access to the new properties at design-time, only in your code at
run-time.
* Create a new application project.
* Select File | New and choose the "DFS" tab in the Object Repository window.
* Select the "Sticky Form" item and click the OK button.
* You should now have a new TdfsStickyForm type form added to the project, and
when you select it all new properties should be visible in the Object
Inspector.
Delphi 2, and C++Builder 1 Notes:
* Although not officially supported, you may be able to use this class with
Delphi 2 and/or C++Builder 1 by following these directions.
The best way to use this form is to add it to your Object Repository.
Simply open this unit in Delphi, right click on the form and select Add
To Repository. Then, when you want a TdfsStickyForm, you just select it
from the repository (File | New) and use the "Inherit" option so you
don't have to see all this code in your form.
Delphi 1 & 2: If you have existing forms that you want converted to sticky
forms, simply add "DFSStickyForm" to your "Uses" clause, and change your
form's ancestor to TdfsStickyForm. An example:
Change:
TMyForm = class(TForm)
To:
TMyForm = class(TdfsStickyForm)
C++Builder 1: To convert existing forms, add the DFSStickyForm.pas file to
the project (using Project Manager), then open the form's header file and
add:
#include "dfsstickyform.hpp"
above the form class declaration. Next, change the form's class declaraion:
Change:
class TForm1 : public TForm
To:
class TForm1 : public TdfsStickyForm
And finally, change the form's constructor in the source (.cpp) file:
Change:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
To:
__fastcall TForm1::TForm1(TComponent* Owner)
: TdfsStickyForm(Owner)
{
Documentation:
* StickTo: TdfsStickyObject
Defines what "object" the form sticks to. Possible values are:
soScreen: Stick to the screen edges
soParent: Stick to the parent of the sticky form
soOwner: Stick to the owner of the sticky form
soNothing: Stick to nothing, also known as a teflon form
* Threshold: integer
When the form comes within this number of pixels of the StickTo object, it
will stick to the object.
Known Issues:
* You currently can not move a stick form past the object that it sticks to.
For example, if sticking to the screen edge, you will not be able to move
the form past the screen edge. In a future version, the form will "unstick"
when it has moved past the outside threshold.
Revision History:
Beta 2: + Updated for Delphi 6 compatibility. See updated install directions
above.
1.00: + Initial release