📄 readme.txt
字号:
Notes:
The TDataLink, that has to react on changes of the dataset,
uses some events (OnBefore..., OnAfter...) of this dataset.
It captures them when it gets active and restores them if
Active gets False.
Please notice this if you set this dataset-events on runtime.
Because a TBDECallback (with cbTableChanged) is used to react on
changes of the dataset, it is not needed to refresh that dataset
manually. If your dataset refreshes itself by reacting on
cbTableChanged (e.g. TSelfRefreshTable, TSelfRefreshQuery), it
saves time if you disable this feature if the dataset is used by
a TCustomDBTreeView only.
Every call of DataSet.Refresh causes a complete rebuild of the
DBTreeView, because it does not know which records changed
eventually.
If you use a procedure WMTimer(var Msg: TWMTimer); message WM_TIMER;
on a decendant of TCustomDBTreeView, please call inherited and
please use a TimerID <> 42, 43 (used by TCustomTreeView) and 1001,
1002, 1003 (used by TCustomDBTreeView, const TimerIDScroll,
TimerIDReBuild, TimerIDMouseSelect).
Look at the TestDbTreeLookupComboBox-project to find out how to
customize the DBTreeView that is shown by the DbTreeLookupComboBox
at DropDown.
- create a new form
- put a DBTreeView or a decendent on it
- recommended properties for this DBTreeView:
Options: [dtAutoShowRoot, dtMouseMoveSelect, dtRebuildFocusedOnly]
(also dtAutoExpand if the lookup-dataset has not many records)
Align: alClient (the size of the form can change at runtime)
ReadOnly: true
SortType: stNone (default)
- add 'dbTreeCBox' to the uses-list
- change the declaration 'TFormX = class(TForm)' into
'TFormX = class(TTreeSelect)'.
There are two possibilites to make DbTreeLookupComboBox use the
special TTreeSelect-dropdown-panel:
1) Use DbTreeLookupComboBox.TreeSelect := FormX.
2) Use the event 'OnCreateTreeSelect' of the DbTreeLookupComboBox
to make the new form the dropdown-panel:
result := TFormX.Create(self);
Use the Project/Options-dialog to say Delphi not to create the
form automatically in your project at startup.
The sample-form in the unit TestSelectForm.PAS adds two buttons to
the dropdown-panel. The clear-button clears the ComboBox and the
edit-button shows a dialog that allows the user to make changes at
the lookup-datasource before selecting a value.
Disclaimer:
Users of this components must accept this disclaimer of warranty:
"This unit is supplied as is. The author disclaims all warranties,
expressed or implied, including, without limitation, the warranties
of merchantability and of fitness for any purpose.
The author assumes no liability for damages, direct or
consequential, which may result from the use of this components."
This components are donated to the public as public domain.
This components can be freely used and distributed in commercial and
private environments provided this notice is not modified in any way.
If you do find this components handy and you feel guilty for using
such a great product without paying someone - sorry :-)
Please forward any comments or suggestions to Christoph Kirchner at:
Internet: ckirchner@geocities.com
Installation:
To add this component to component palette do:
- From Delphi IDE Options Menu select Components / Install
- Add RegisterDbTreeView.PAS
- Add RegisterDbTreeLookupComboBox.PAS
- Optional: Add RegisterTreeViewEx.PAS
Updates:
Version 0.4:
- TCustomDBTreeView.Table changed to TCustomDBTreeView.DataSet
(Querys as dataset possible now).
Version 0.5:
- A lot of optimization is done. In previous versions, a complete
rebuild of the tree was needed on every change of the dataset.
At the building of the tree, the dataset get read once from
first to last record instead of searching the parent-records.
- The Option dtSynchronizeDataSet is added. If not set, the
selected node of the tree and the current record of the dataset
are only synchronized if needed. You can use the methods
SynchronizeSelectedNodeToCurrentRecord and SynchronizeCurrent-
RecordToSelectedNode if needed.
- New event: OnRootNotFound.
- A TBDECallback (with cbTableChanged) is used to react on changes
of the dataset.
- In previous versions of DbTreeLookupComboBox, a complete
rebuild of the tree was needed on every dropdown. With
dtKeepDataSetConnected set in Options, the build of the tree
is done only once.
- With TDbTreeLookupComboBox.PrepareDropdown you can prepare the
dropdown-panel at startup of the application.
- The dropdown-panel never gets hidden by the Win95-Taskbar now.
- DbTreeLookupComboBox.Options dtAcceptLeavesOnly and
dtDontAcceptRoot added.
Version 0.6:
- The existance of a record with the ID of RootID is not required
no more. If no record with the ID of RootID exists, all records
with the Parent of RootID will become roots.
- The procedure IsRootNode now tests if the node has no parent, in
previous versions it tested if the ID of the node is the RootID.
- The Option dtRebuildFocusedOnly is added (and the dropdown-panel
of DbTreeLookupComboBox use it).
Version 0.61:
- The Option dtConfirmDelete now affects all attempts of deleting
a record, even if it is done by a navigation-button and if the
record is not the current record.
- TDbTreeLookupComboBox uses TCustomDBTreeView only
(no TDBTreeView).
- Bugfixes (unit RegisterDbTreeLookupComboBox).
Version 0.62:
- TCustomDBTreeView does not need SortType = stText no more to
sort the nodes. (You can not imagine, what a lot of optimization
it is to build a tree with SortType = stNone!)
It is recommended that you set SortType to stNone on all of the
TDBTreeView's you made with previous versions, but it is not
really needed because SortType will be set to stNone before a
rebuild and restored after - even that saves a LOT of time.
- Optimization: SetDataSource does not call BuildTree no more,
because this will be done at ActiveChanged too.
Version 0.63:
- Option dtAutoShowRoot added.
- Option dtMouseMoveSelect added.
- If the user drags a node, the TDBTreeView scrolls if the mouse
is near the upper or lower border of the TDbTreeView.
- The dropdown-panel of DbTreeLookupComboBox uses the new Options
dtAutoShowRoot and dtMouseMoveSelect.
Version 0.7:
- If a node is dragged near upper or lower border, the treeview
scrolls.
- Dragging can get cancelled with the escape-key.
- The dropdown-panel looks more like a dropdown-panel of a combo-
box (small border).
- If the mouse get moved in the dropdown-panel while pressed, the
treeview scrolls.
- Quick-search (typing the first letters of the searched value
into the combo-box) and moving through the data with the cursor-
up or cursor-down keys now selects only values that are accepted.
To decide wich values are accepted use the options dtAcceptLeaves-
Only and dtDontAcceptRoot and/or the event OnAcceptNode.
- The property PosUnderComboBox (Boolean) is added to TTreeSelect.
If True, the dropdown-panel is shown under the combo-box.
The TSampleTreeSelect-form of the DbTreeLookupComboBox sample
program now uses the OnFormActivate-event to arrange the controls
instead of the OnResize-event because the OnFormActivate-event is
called at each dropdown and PosUnderComboBox could have been
changed after last dropdown.
Version 0.71:
- Runs with Delphi 3.0. Thanks to Georg Ledermann for his help.
- Property RSelected (TTreeNode) added.
- PopupMenu works now as in the Win95-Explorer: The right-clicked
node gets the focus but is not selected if it was not selected
before. If the button gets released without moving the mouse
before, the PopupMenu will appear under the focused node (please
note that this node is not focused in this moment anymore -
use the property RSelected to get it).
- If a node gets clicked on a dropdown-panel, it gets not accepted
immediately if it has children - it waits for a double-click
to expand or collaps and gets accepted if no double-click occures.
Version 0.72:
- D3: Using dsndbcst.tpu did not work with Packages.
- Function IDOfNode() added. Please use this function to get the
ID of a Node (e.g. IDOfNode(Selected)) instead of getting the ID
from TTreeNode.Data (e.g. Longint(Selected.Data)).
- DbTreeLookupComboBox: Changes made by Paul C. Lambadaris to
avoid {$R TTreeSel.DFM}.
Version 0.73:
- New TTreeViewEx component.
- Function GetDeleteQuestion() added.
- The Clear-button of the DbTreeLookupComboBox sample did not work
(OnAcceptNode has to work with parameter Node = nil too).
Version 0.8:
- DbTreeView and DbTreeLookupComboBox are now in one zip-file.
- "Virtual Corporation Demo" added.
- TTreeNode.Data is free for your use now. This means that you
can not use Longint(Node.Data) to get the ID of a Node no more.
You have to use IDOfNode(Node) instead to get the ID.
- The type of the ID's has changed from Integer to String. (You
can still use fields of DataType ftInteger, but ftString is also
possible now). Because the type of the ID's has changed: Please
SET ALL PROPERTIES RootID TO 0 BEFORE YOU UPDATE TO THIS VERSION.
- You can leave the property RootID empty now - the DBTreeview will
scan the structure of the data itself (the build of the tree gets
faster if RootID is set).
- You can leave the property TableParentField empty now - the
DBTreeview will show a flat list of all records. This is Useful
if you need a record list as drag source - the TDBGrid has no
OnMouseMove event do do this.
Version 0.81:
- Bug in unit ECDataLink corrected by Main Chen: Sometimes the
the OnXXX-events of the DataSet got not called.
Version 0.82:
- Option dtInsertAsChild added.
- A new item created with the insert key gets inserted under the
selected node. To insert it as a child of the selected node as
the previous versions did, include dtInsertAsChild into Options.
- A new item created with ctrl-insert gets inserted as a child of
the selected node.
- If the RootID is empty, more than one root item is allowed.
Then, and if dtAutoDragMove is in Options, a node can get moved
to become a root.
- OnGetNextID event added.
Version 0.83:
- Bugfix: The DestroyWnd method did not save the ID's of the Nodes
so they were lost after the next call of CreateWnd.
- Bugfix: After expand/collapse the root node several times, the
refresh time for the tree window goes to eternity. I haven't found
the reason for this, but Zlatko Ivankovic has made a bugfix that
improves the Treeviews also (TCustomTreeViewEx.IsSingleRootNode).
It is recommended to rebuild the Delphi component library after
updating a component.
PS:
Maybe you can find an update of this component at my
"Delphi Component Building Site":
http://www.geocities.com/SiliconValley/Heights/7874/delphi.htm
Also, there are components that are not released to the
Delphi-Super-Page yet because they are not tested, not finished,
without readme or just currently under construction -
if one or more of them are useful for you:
You can help me beta-testing them... :-)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -