Added ole demo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@111 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2007-03-03 14:56:24 +00:00
parent 7287d9f1f5
commit db352a016a
7 changed files with 1603 additions and 0 deletions

View File

@ -0,0 +1,584 @@
object MainForm: TMainForm
Left = 347
Height = 575
Top = 303
Width = 790
HorzScrollBar.Page = 789
VertScrollBar.Page = 574
ActiveControl = Button1
Caption = 'Demo for drag''n drop and clipboard transfers'
Font.CharSet = ANSI_CHARSET
Font.Height = -12
Font.Name = 'Arial'
OnCreate = FormCreate
Visible = True
object Label1: TLabel
Left = 10
Height = 15
Top = 96
Width = 239
Caption = 'Tree 1 uses OLE when initiating a drag operation.'
Color = clNone
Font.CharSet = ANSI_CHARSET
Font.Height = -11
Font.Name = 'Arial'
ParentColor = False
end
object Label2: TLabel
Left = 360
Height = 33
Top = 80
Width = 337
AutoSize = False
Caption = 'Tree 2 uses VCL when initiating a drag operation. It also uses manual drag mode. Only marked lines are allowed to start a drag operation.'
Color = clNone
Font.CharSet = ANSI_CHARSET
Font.Height = -11
Font.Name = 'Arial'
ParentColor = False
WordWrap = True
end
object Panel3: TPanel
Height = 69
Width = 790
Align = alTop
Color = clWhite
ParentColor = False
TabOrder = 0
object Label6: TLabel
Left = 36
Height = 42
Top = 15
Width = 273
AutoSize = False
Caption = 'This demo shows how to cope with OLE drag''n drop as well as cut, copy and paste.'
Color = clNone
Font.CharSet = ANSI_CHARSET
Font.Height = -12
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentColor = False
WordWrap = True
end
end
object Button1: TButton
Left = 705
Height = 25
Top = 527
Width = 75
Anchors = [akRight, akBottom]
BorderSpacing.InnerBorder = 4
Caption = 'Close'
OnClick = Button1Click
TabOrder = 1
end
object Button3: TButton
Left = 709
Height = 25
Top = 80
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
Caption = 'Tree font...'
OnClick = Button3Click
ParentShowHint = False
TabOrder = 2
end
object Tree2: TVirtualStringTree
Left = 364
Height = 180
Top = 116
Width = 330
ClipboardFormats.Strings = (
'Plain text'
'Unicode text'
'Virtual Tree Data'
)
Colors.BorderColor = clWindowText
Colors.HotColor = clBlack
DefaultNodeHeight = 24
DragOperations = [doCopy, doMove, doLink]
DragType = dtVCL
DragWidth = 350
EditDelay = 500
Font.CharSet = ANSI_CHARSET
Font.Height = -11
Font.Name = 'Lucida Sans Unicode'
Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif'
Header.MainColumn = -1
Header.Options = [hoColumnResize, hoDrag]
HintMode = hmTooltip
ParentShowHint = False
ShowHint = True
TabOrder = 3
TreeOptions.AnimationOptions = [toAnimatedToggle]
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toAutoTristateTracking, toAutoHideButtons]
TreeOptions.MiscOptions = [toAcceptOLEDrop, toInitOnSave, toToggleOnDblClick, toWheelPanning]
TreeOptions.SelectionOptions = [toMultiSelect, toCenterScrollIntoView]
OnBeforeItemErase = Tree2BeforeItemErase
OnDragAllowed = Tree2DragAllowed
OnDragOver = TreeDragOver
OnDragDrop = TreeDragDrop
OnGetText = Tree1GetText
OnInitNode = TreeInitNode
OnNewText = Tree1NewText
Columns = <>
end
object Tree1: TVirtualStringTree
Left = 10
Height = 180
Top = 116
Width = 330
ClipboardFormats.Strings = (
'CSV'
'HTML Format'
'Plain text'
'Rich Text Format'
'Rich Text Format Without Objects'
'Unicode text'
)
Colors.BorderColor = clWindowText
Colors.HotColor = clBlack
DefaultNodeHeight = 24
DragMode = dmAutomatic
DragWidth = 350
EditDelay = 500
Font.CharSet = ANSI_CHARSET
Font.Height = -11
Font.Name = 'Verdana'
Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif'
Header.MainColumn = -1
Header.Options = [hoColumnResize, hoDrag]
HintMode = hmTooltip
Images = TreeImages
ParentShowHint = False
ShowHint = True
TabOrder = 4
TreeOptions.AnimationOptions = [toAnimatedToggle]
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toAutoTristateTracking, toAutoHideButtons, toAutoDeleteMovedNodes]
TreeOptions.MiscOptions = [toAcceptOLEDrop, toInitOnSave, toToggleOnDblClick, toWheelPanning]
TreeOptions.SelectionOptions = [toMultiSelect]
OnDragOver = TreeDragOver
OnDragDrop = TreeDragDrop
OnGetText = Tree1GetText
OnInitNode = TreeInitNode
OnNewText = Tree1NewText
Columns = <>
end
object PageControl1: TPageControl
Left = 12
Height = 245
Top = 308
Width = 685
ActivePage = TabSheet1
Anchors = [akTop, akLeft, akBottom]
TabIndex = 3
TabOrder = 5
object RichTextTabSheet: TTabSheet
Caption = 'Rich text'
ImageIndex = 1
object Label3: TLabel
Left = 8
Height = 15
Top = 8
Width = 453
Caption = 'You can use the rich edit control as source and as target. It initiates OLE drag'' drop.'
Color = clNone
ParentColor = False
end
end
object LogTabSheet: TTabSheet
Caption = 'Drag''n drop operation log'
object Label7: TLabel
Left = 6
Height = 41
Top = 8
Width = 403
AutoSize = False
Caption = 'The log below shows textual representations of the operation carried out. You can also use the control as VCL drag source.'
Color = clNone
ParentColor = False
WordWrap = True
end
object LogListBox: TListBox
Left = 4
Height = 145
Hint = 'Use the list box to initiate a VCL drag''n drop.'
Top = 56
Width = 661
Anchors = [akTop, akLeft, akRight, akBottom]
DragMode = dmAutomatic
ItemHeight = 15
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object Button2: TButton
Left = 590
Height = 25
Top = 10
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
Caption = 'Clear log'
OnClick = Button2Click
TabOrder = 1
end
end
object TabSheet2: TTabSheet
Caption = 'More info'
ImageIndex = 3
object Label4: TLabel
Left = 12
Height = 37
Top = 52
Width = 649
AutoSize = False
Caption = 'For drag''n drop however it can (mainly for compatibility) either use OLE or VCL for drag operations. Since both approaches are incompatible and cannot be used together only one of them can be active at a time.'
Color = clNone
ParentColor = False
WordWrap = True
end
object Label5: TLabel
Left = 12
Height = 29
Top = 94
Width = 653
AutoSize = False
Caption = 'This, though, applies only to the originator of a drag operation. The receiver can handle both situations simultanously.'
Color = clNone
ParentColor = False
WordWrap = True
end
object Label9: TLabel
Left = 12
Height = 33
Top = 12
Width = 637
AutoSize = False
Caption = 'Virtual Treeview always uses OLE for clipboard operations. Windows ensures that an IDataObject is always available, even if an application used the clipboard in the old way.'
Color = clNone
ParentColor = False
WordWrap = True
end
end
object TabSheet1: TTabSheet
Caption = 'Tips'
ImageIndex = 2
object Label8: TLabel
Left = 12
Height = 37
Top = 16
Width = 653
AutoSize = False
Caption = 'Try drag''n drop and clipboard operations also together with other applications like Word or the Internet Explorer.'
Color = clNone
ParentColor = False
WordWrap = True
end
object Label10: TLabel
Left = 12
Height = 37
Top = 48
Width = 653
AutoSize = False
Caption = 'Also quite interesting is to start more than one instance of this demo and drag data between these instances. This works however only for OLE drag'' drop.'
Color = clNone
ParentColor = False
WordWrap = True
end
end
end
object ActionList1: TActionList
left = 724
top = 156
object CutAction: TAction
Caption = 'Cut'
DisableIfNoHandler = True
OnExecute = CutActionExecute
ShortCut = 16472
end
object CopyAction: TAction
Caption = 'Copy'
DisableIfNoHandler = True
OnExecute = CopyActionExecute
ShortCut = 16451
end
object PasteAction: TAction
Caption = 'Paste'
DisableIfNoHandler = True
OnExecute = PasteActionExecute
ShortCut = 16470
end
end
object FontDialog: TFontDialog
Title = 'Select a font'
Font.Height = -11
Font.Name = 'MS Sans Serif'
left = 756
top = 168
end
object TreeImages: TImageList
left = 706
top = 212
Bitmap = {
6C691200000010000000100000009C0100002F2A2058504D202A2F0A73746174
69632063686172202A677261706869635B5D203D207B0A223136203136203320
31222C0A222E2063204E6F6E65222C0A222C20632023383430303030222C0A22
2D20632023464646464646222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E22
2C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2C2C2D2E2E2E2E2E
2E2E2E2C2C2D2E222C0A222E2C2C2C2C2D2E2E2E2E2E2C2C2D2E2E222C0A222E
2E2C2C2C2C2D2E2E2E2C2C2D2E2E2E222C0A222E2E2E2E2C2C2C2D2E2C2D2E2E
2E2E2E222C0A222E2E2E2E2E2C2C2C2C2C2D2E2E2E2E2E222C0A222E2E2E2E2E
2E2C2C2C2D2E2E2E2E2E2E222C0A222E2E2E2E2E2C2C2C2C2C2D2E2E2E2E2E22
2C0A222E2E2E2E2C2C2C2D2E2C2C2D2E2E2E2E222C0A222E2E2E2C2C2C2D2E2E
2E2C2C2D2E2E2E222C0A222E2E2C2C2C2D2E2E2E2E2E2C2D2E2E2E222C0A222E
2E2C2C2C2D2E2E2E2E2E2E2C2D2E2E222C0A222E2E2E2C2D2E2E2E2E2E2E2E2E
2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2C2D2E222C0A222E2E2E2E2E
2E2E2E2E2E2E2E2E2E2E2E227D0A9C0100002F2A2058504D202A2F0A73746174
69632063686172202A677261706869635B5D203D207B0A223136203136203320
31222C0A222E2063204E6F6E65222C0A222C20632023303030303030222C0A22
2D20632023464646464646222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E22
2C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2C2C2C2C2C2C
2C2C2E2E2E2E2E222C0A222E2E2E2C2D2D2D2D2D2D2C2C2E2E2E2E222C0A222E
2E2E2C2D2D2D2D2D2D2C2D2C2E2E2E222C0A222E2E2E2C2D2D2D2D2D2D2C2C2C
2C2E2E222C0A222E2E2E2C2D2D2D2D2D2D2D2D2D2C2E2E222C0A222E2E2E2C2D
2D2D2D2D2D2D2D2D2C2E2E222C0A222E2E2E2C2D2D2D2D2D2D2D2D2D2C2E2E22
2C0A222E2E2E2C2D2D2D2D2D2D2D2D2D2C2E2E222C0A222E2E2E2C2D2D2D2D2D
2D2D2D2D2C2E2E222C0A222E2E2E2C2D2D2D2D2D2D2D2D2D2C2E2E222C0A222E
2E2E2C2D2D2D2D2D2D2D2D2D2C2E2E222C0A222E2E2E2C2D2D2D2D2D2D2D2D2D
2C2E2E222C0A222E2E2E2C2C2C2C2C2C2C2C2C2C2C2E2E222C0A222E2E2E2E2E
2E2E2E2E2E2E2E2E2E2E2E227D0AAB0100002F2A2058504D202A2F0A73746174
69632063686172202A677261706869635B5D203D207B0A223136203136203420
31222C0A222E2063204E6F6E65222C0A222C20632023303030303030222C0A22
2D20632023464646464646222C0A222A20632023303030303834222C0A222E2E
2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E
2E2E222C0A222E2C2C2C2C2C2C2E2E2E2E2E2E2E2E2E222C0A222E2C2D2D2D2D
2C2C2E2E2E2E2E2E2E2E222C0A222E2C2D2D2D2D2C2D2C2E2E2E2E2E2E2E222C
0A222E2C2D2C2C2D2C2A2A2A2A2A2A2E2E2E222C0A222E2C2D2D2D2D2D2A2D2D
2D2D2A2A2E2E222C0A222E2C2D2C2C2C2C2A2D2D2D2D2A2D2A2E222C0A222E2C
2D2D2D2D2D2A2D2C2C2D2A2A2A2A222C0A222E2C2D2C2C2C2C2A2D2D2D2D2D2D
2D2A222C0A222E2C2D2D2D2D2D2A2D2C2C2C2C2C2D2A222C0A222E2C2C2C2C2C
2C2A2D2D2D2D2D2D2D2A222C0A222E2E2E2E2E2E2E2A2D2C2C2C2C2C2D2A222C
0A222E2E2E2E2E2E2E2A2D2D2D2D2D2D2D2A222C0A222E2E2E2E2E2E2E2A2A2A
2A2A2A2A2A2A222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0AD80100
002F2A2058504D202A2F0A7374617469632063686172202A677261706869635B
5D203D207B0A22313620313620372031222C0A222E2063204E6F6E65222C0A22
2C20632023303030303030222C0A222D20632023464646463030222C0A222A20
632023383438343834222C0A226120632023383438343030222C0A2262206320
23303030303834222C0A226320632023464646464646222C0A222E2E2E2E2E2E
2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2E2E2E2C2C2C2C2E2E2E2E2E2E222C
0A222E2E2C2C2C2C2C2D2D2C2C2C2C2C2E2E222C0A222E2C2A612A2C2D2C2C2D
2C612A612C2E222C0A222E2C612A2C2E2E2E2E2E2E2C612A2C2E222C0A222E2C
2A612C2C2C2C2C2C2C2C2A612C2E222C0A222E2C612A612A612A612A612A612A
2C2E222C0A222E2C2A612A612A626262626262622C2E222C0A222E2C612A612A
6162636363636362622E222C0A222E2C2A612A612A626363636363626362222C
0A222E2C612A612A61626362626263626262222C0A222E2C2A612A612A626363
636363636362222C0A222E2C612A612A61626362626262626362222C0A222E2E
2C2C2C2C2C626363636363636362222C0A222E2E2E2E2E2E2E62626262626262
6262222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0ABA0100002F2A20
58504D202A2F0A7374617469632063686172202A677261706869635B5D203D20
7B0A22313620313620352031222C0A222E20632023464646463030222C0A222C
2063204E6F6E65222C0A222D20632023383438343834222C0A222A2063202330
3030303030222C0A226120632023464646464646222C0A222E2C2C2D2E2C2C2D
2A2A2A2C2C2C2C2C222C0A222D2E2C2D612C2D2E61612A2A2C2C2C2C222C0A22
2C2D2E2D2E2D2E6161612A612A2C2C2C222C0A222C2E2D2E612D2D2D2D612A61
612A2C2C222C0A222D2D2D612E2E616161612A2A2A2A2A2C222C0A222C2C612D
61612D2A2A61616161612A2C222C0A222D2C2C2D2E6161616161616161612A2C
222C0A222C2C2C2D612A2A2A2A2A2A2A61612A2C222C0A222C2C2C2A61616161
6161616161612A2C222C0A222C2C2C2A612A2A2A2A2A2A2A61612A2C222C0A22
2C2C2C2A616161616161616161612A2C222C0A222C2C2C2A612A2A2A2A2A2A2A
61612A2C222C0A222C2C2C2A616161616161616161612A2C222C0A222C2C2C2A
616161616161616161612A2C222C0A222C2C2C2A2A2A2A2A2A2A2A2A2A2A2A2C
222C0A222C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C227D0AC90100002F2A205850
4D202A2F0A7374617469632063686172202A677261706869635B5D203D207B0A
22313620313620362031222C0A222E2063204E6F6E65222C0A222C2063202330
3030303834222C0A222D20632023464646464646222C0A222A20632023303030
303030222C0A226120632023383438343834222C0A2262206320234646464630
30222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222C2C2C2C2C2C2C
2C2C2C2C2C2C2C2E2E222C0A222C2D2C2C2C2C2C2C2C2C2C2C2C2C2E2E222C0A
222C2C2C2C2C2C2C2C2C2C2C2C2C2A2E2E222C0A222A2E2E2E2A2D2D2D2D2D2D
2D2D2A2E2E222C0A222A2E2E2E2A2D2D2D2D2D2D2D2D2A2E2E222C0A222A2E2E
2E2A2D2D6161612D2D2D2A2E2E222C0A222A2E2E2E2A2D612E622E612D2D2A2E
2E222C0A222A2E2E2E2A612E622E6261616161612E222C0A222A2E2E2E2A612D
2D2D2D2D2D2D2D612A222C0A222A2E2E2E2A612D622E622E622E62612A222C0A
222A2E2E2E2A612D2E622E622E622E612A222C0A222A2A2A2A2A612D622E622E
622E62612A222C0A222E2E2E2E2E616161616161616161612A222C0A222E2E2E
2E2E2E2A2A2A2A2A2A2A2A2A2A222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E
2E227D0AC90100002F2A2058504D202A2F0A7374617469632063686172202A67
7261706869635B5D203D207B0A22313620313620362031222C0A222E2063204E
6F6E65222C0A222C20632023303030303834222C0A222D206320233030303030
30222C0A222A20632023464646464646222C0A22612063202338343834383422
2C0A226220632023303046464646222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E
2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222C2C2C2C2C2C
2C2C2C2E2E2E2E2E2E2E222C0A222C2C2C2C2C2C2C2C2C2E2E2E2E2E2E2E222C
0A222D2A2A2A2A2A2A2A2D2E2D2E2E2E2E2E222C0A222D2A61616161612A2D2E
2D2D2E2E2E2E222C0A222D2A2A2A2A2A2A2A2D2E2D622D2E2E2E222C0A222D2A
61612D2D2D2D2D2D2D62622D2E2E222C0A222D2A2A2A2D626262626262626262
2D2E222C0A222D2D2D2D2D626262626262626262622D222C0A222E2E2E2E2D62
62626262626262622D2E222C0A222E2E2E2E2D2D2D2D2D2D2D62622D2E2E222C
0A222E2E2E2E2E2E2E2E2E2E2D622D2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E
2D2D2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2D2E2E2E2E2E222C0A222E2E
2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0AAB0100002F2A2058504D202A2F0A73
74617469632063686172202A677261706869635B5D203D207B0A223136203136
20342031222C0A222E2063204E6F6E65222C0A222C2063202330303030303022
2C0A222D20632023303030303834222C0A222A20632023464646464646222C0A
222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2E2E2E2E2C2C2C2C
2C2C2E2D2D222C0A222E2E2E2E2E2E2C2E2E2E2E2E2E2C2D2D222C0A222E2E2E
2E2E2C2E2C2E2E2E2E2E2E2D2D222C0A222C2C2C2C2C2E2C2E2C2E2E2E2E2E2D
2D222C0A222C2A2A2C2E2C2E2C2E2C2E2E2E2C2D2D222C0A222C2A2C2E2C2A2C
2E2C2E2C2C2C2E2D2D222C0A222C2A2A2C2A2A2A2C2E2C2A2C2E2E2E2D222C0A
222C2A2A2A2A2A2A2A2C2A2A2C2E2E2E2E222C0A222C2A2A2A2A2A2A2A2A2A2A
2C2E2E2E2E222C0A222C2A2C2C2A2C2C2C2C2C2A2C2E2E2E2E222C0A222C2A2A
2A2A2A2A2A2A2A2A2C2E2E2E2E222C0A222C2A2C2C2A2C2C2C2C2C2A2C2E2E2E
2E222C0A222C2A2A2A2A2A2A2A2A2A2A2C2E2E2E2E222C0A222C2C2C2C2C2C2C
2C2C2C2C2C2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0A
F60100002F2A2058504D202A2F0A7374617469632063686172202A6772617068
69635B5D203D207B0A22313620313620392031222C0A222E2063204E6F6E6522
2C0A222C20632023383438343834222C0A222D20632023303030304646222C0A
222A20632023464646464646222C0A226120632023303038343030222C0A2262
20632023303030303030222C0A226320632023464646463030222C0A22642063
2023303038343834222C0A226520632023303030303834222C0A222E2E2E2E2E
2C2C2C2C2C2E2E2E2E2E2E222C0A222E2E2E2C2C2D2D2A2E6162622E2E2E2E22
2C0A222E2E2C2D2D2E2A2E61616161622E2E2E222C0A222E2C2D2A2E2A2C2C2C
2C2C2C2C622E2E222C0A222E2C2D2D2A2E2C2A2A2A632A2C2C2E2E222C0A2262
2D2D2E61612C2A632A2A2A2C2A2C2E222C0A22622D2D6161612C2A2A2A632A62
626262222C0A22622D2D6161612C2A636464642C2A2C62222C0A22622D2D2D61
612C2A642A2C61652A2C62222C0A22622D2D2D2D2D2C2A642C612D652A2C6222
2C0A222E622D2D2D2D2C2A642D2D2D652A2C62222C0A222E622D2D2D2D2C2A63
6565652C2A2C62222C0A222E2E622D2D2D2C2A2A2A632A2A2A2C62222C0A222E
2E2E62622D2C2A632A2A2A632A2C62222C0A222E2E2E2E2E622C2C2C2C2C2C2C
2C2C62222C0A222E2E2E2E2E2E62626262626262626262227D0A9C0100002F2A
2058504D202A2F0A7374617469632063686172202A677261706869635B5D203D
207B0A22313620313620332031222C0A222E2063204E6F6E65222C0A222C2063
2023464646464646222C0A222D20632023303038343030222C0A222E2E2E2E2E
2E2E2E2E2E2E2E2E2E2E2E222C0A222E2C2C2C2C2C2C2C2C2C2C2C2C2C2C2E22
2C0A222E2C2C2C2C2C2C2C2D2C2C2C2C2C2C2E222C0A222E2C2C2C2C2C2C2C2D
2D2C2C2C2C2C2E222C0A222E2C2C2C2C2D2D2D2D2D2D2C2C2C2C2E222C0A222E
2C2C2C2D2C2C2C2D2D2C2C2C2C2C2E222C0A222E2C2C2C2D2C2C2C2D2C2C2C2C
2C2C2E222C0A222E2C2C2C2D2C2C2C2C2C2C2C2C2C2C2E222C0A222E2C2C2C2C
2C2C2C2C2C2C2D2C2C2C2E222C0A222E2C2C2C2C2C2C2D2C2C2C2D2C2C2C2E22
2C0A222E2C2C2C2C2C2D2D2C2C2C2D2C2C2C2E222C0A222E2C2C2C2C2D2D2D2D
2D2D2C2C2C2C2E222C0A222E2C2C2C2C2C2D2D2C2C2C2C2C2C2C2E222C0A222E
2C2C2C2C2C2C2D2C2C2C2C2C2C2C2E222C0A222E2C2C2C2C2C2C2C2C2C2C2C2C
2C2C2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0ABA0100002F2A
2058504D202A2F0A7374617469632063686172202A677261706869635B5D203D
207B0A22313620313620352031222C0A222E2063204E6F6E65222C0A222C2063
2023383438343834222C0A222D20632023303030303030222C0A222A20632023
464646464646222C0A226120632023303030303834222C0A222E2E2E2E2E2E2E
2E2E2E2E2E2E2E2E2E222C0A222E2E2E2E2E2C2C2C2C2C2C2D2E2E2E2E222C0A
222E2E2E2E2E2C2A2A2A2A2A2D2E2E2E2E222C0A222E2E2E2E2E2C2A2C2C2C2C
2C2C2D2E2E222C0A22612E2E2E2E2C2A2C2A2A2A2A2A2D2E2E222C0A2261612E
2E2E2C2A2C2A2C2C2C2C2C2C2D222C0A226161612E2E2C2A2C2A2C2A2A2A2A2A
2D222C0A22616161612E2C2A2C2A2C2A6161612A2D222C0A226161612E2E2C2A
2C2A2C2A2A2A2A2A2D222C0A2261612E2E2E2D2D2C2A2C2A6161612A2D222C0A
22612E2E2E2E2E2E2C2A2C2A2A2A2A2A2D222C0A222E2E2E2E2E2E2E2D2D2C2A
6161612A2D222C0A222E2E2E2E2E2E2E2E2E2C2A2A2A2A2A2D222C0A222E2E2E
2E2E2E2E2E2E2D2D2D2D2D2D2D222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E
2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0AC90100002F2A2058
504D202A2F0A7374617469632063686172202A677261706869635B5D203D207B
0A22313620313620362031222C0A222E2063204E6F6E65222C0A222C20632023
383438343834222C0A222D20632023464646463030222C0A222A206320234336
43364336222C0A226120632023464646464646222C0A22622063202330303030
3030222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2C2C2C
2C2C2E2E2E2E2E2E2E2E222C0A222E2E2C2D2A2D2A2D2C2E2E2E2E2E2E2E222C
0A222E2C2D2A2D2A2D2A2D2C2C2C2C2C2C2E222C0A222E2C6161616161616161
616161612C62222C0A222E2C612D2A2D2A2D2A2D2A2D2A2D2C62222C0A222E2C
612A2D2A2D2A2D2A2D2A2D2A2C62222C0A222E2C612D2A2D2A2D2A2D2A2D2A2D
2C62222C0A222E2C612A2D2A2D2A2D2A2D2A2D2A2C62222C0A222E2C612D2A2D
2A2D2A2D2A2D2A2D2C62222C0A222E2C612A2D2A2D2A2D2A2D2A2D2A2C62222C
0A222E2C612D2A2D2A2D2A2D2A2D2A2D2C62222C0A222E2C2C2C2C2C2C2C2C2C
2C2C2C2C2C62222C0A222E2E6262626262626262626262626262222C0A222E2E
2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E
2E2E227D0AC90100002F2A2058504D202A2F0A7374617469632063686172202A
677261706869635B5D203D207B0A22313620313620362031222C0A222E206320
4E6F6E65222C0A222C20632023383438343834222C0A222D2063202346464646
4646222C0A222A20632023464646463030222C0A226120632023433643364336
222C0A226220632023303030303030222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E
2E2E2E222C0A222E2E2E2C2C2C2C2C2E2E2E2E2E2E2E2E222C0A222E2E2C2D2D
2D2D2D2C2E2E2E2E2E2E2E222C0A222E2C2D2A612A612A2D2C2C2C2C2C2C2E22
2C0A222E2C2D612A612A612D2D2D2D2D2D2C62222C0A222E2C2D2A612A612A61
2A612A612A2C62222C0A222C2C2C2C2C2C2C2C2C2C2C2C2C2A2C62222C0A222C
2D2D2D2D2D2D2D2D2D2D2C2C612C62222C0A222C2D2A612A612A612A612A2A62
2C2C62222C0A222E2C2D2A612A612A612A612A61622C62222C0A222E2C2D612A
612A612A612A612A622C62222C0A222E2E2C2D612A612A612A612A2A2C626222
2C0A222E2E2C2C2C2C2C2C2C2C2C2C2C2C2C62222C0A222E2E2E626262626262
62626262626262222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E
2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0ABA0100002F2A2058504D202A2F0A
7374617469632063686172202A677261706869635B5D203D207B0A2231362031
3620352031222C0A222E2063204E6F6E65222C0A222C20632023383438343834
222C0A222D20632023464646464646222C0A222A20632023303030303030222C
0A226120632023433643364336222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E
2E222C0A222E2C2C2C2C2C2C2C2C2E2E2E2E2E2E2E222C0A222E2C2D2D2D2D2D
2D2C2A2E2E2E2E2E2E222C0A222E2C2D2D2D2D2D2D2C2D2A2E2E2E2E2E222C0A
222E2C2D2D2D2D2D2D2C2A2A2A2E2E2E2E222C0A222E2C2D2D2D2D2D2D616161
2A2E2E2E2E222C0A222E2C2D2D2D2D2D2D2D61612A2E2E2E2E222C0A222E2C2D
2D2D2D2D2D2D2D612A2E2E2E2E222C0A222E2C2D2D2D2D2D2D2D2D612A2E2E2E
2E222C0A222E2C2D2D2D2D2D2D2D2D612A2E2E2E2E222C0A222E2C2D2D2D2D2D
2D2D2D612A2E2E2E2E222C0A222E2C2D2D2D2D2D2D2D2D612A2E2E2E2E222C0A
222E2C6161616161616161612A2E2E2E2E222C0A222E2A2A2A2A2A2A2A2A2A2A
2A2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E
2E2E2E2E2E2E2E2E2E2E2E2E2E227D0AF60100002F2A2058504D202A2F0A7374
617469632063686172202A677261706869635B5D203D207B0A22313620313620
392031222C0A222E2063204E6F6E65222C0A222C20632023383438343834222C
0A222D20632023464646464646222C0A222A20632023303030303030222C0A22
6120632023303030304646222C0A226220632023303030303834222C0A226320
632023303038343834222C0A226420632023433643364336222C0A2265206320
23464646463030222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E
2C2C2C2C2C2C2C2C2E2E2E2E2E2E2E222C0A222E2C2D2D2D2D2D2D2C2A2E2E2E
2E6162222C0A222E2C2D2D2D2D2D2D2C2D2A2E2E616362222C0A222E2C2D2D2D
2D2D2D2C2A2A2A6163622E222C0A222E2C2D2D2D2D2D2D6464646163622E2E22
2C0A222E2C2D2D2D2D2D2D2D646163622E2E2E222C0A222E2C2D2D2D2D2D2D2D
6163622E2E2E2E222C0A222E2C2D2D2D2D2D2D6163622A2E2E2E2E222C0A222E
2C2D2D2D2D2D2C6562642A2E2E2E2E222C0A222E2C2D2D2D2D2D642C2D642A2E
2E2E2E222C0A222E2C2D2D2D2D2A2C2D2D642A2E2E2E2E222C0A222E2C646464
6464646464642A2E2E2E2E222C0A222E2A2A2A2A2A2A2A2A2A2A2A2E2E2E2E22
2C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E
2E2E2E2E2E2E2E227D0ABA0100002F2A2058504D202A2F0A7374617469632063
686172202A677261706869635B5D203D207B0A22313620313620352031222C0A
222E20632023383438343834222C0A222C2063204E6F6E65222C0A222D206320
23464646464646222C0A222A20632023303030303030222C0A22612063202343
3643364336222C0A222E2E2E2E2E2E2E2E2C2C2C2C2C2C2C2C222C0A222E2D2E
2E2E2E2E2E2E2E2C2C2C2C2C2C222C0A222E2D2E2D2E2E2E2E2E2E2E2E2C2C2C
2C222C0A222E2D2E2D2E2D2D2D2D2D2D2E2A2C2C2C222C0A222E2D2E2D2E2D2D
2D2D2D2D2E2D2A2C2C222C0A222E2D2E2D2E2D2D2D2D2D2D2E2A2A2A2C222C0A
222E2D2E2D2E2D2D2D2D2D2D6161612A2C222C0A222E2D2E2D2E2D2D2D2D2D2D
2D61612A2C222C0A222E2D2E2D2E2D2D2D2D2D2D2D2D612A2C222C0A222E2D2E
2D2E2D2D2D2D2D2D2D2D612A2C222C0A222E2D2E2D2E2D2D2D2D2D2D2D2D612A
2C222C0A222E612E2D2E2D2D2D2D2D2D2D2D612A2C222C0A222A2A2E612E2D2D
2D2D2D2D2D2D612A2C222C0A222C2C2A2A2E6161616161616161612A2C222C0A
222C2C2C2C2A2A2A2A2A2A2A2A2A2A2A2C222C0A222C2C2C2C2C2C2C2C2C2C2C
2C2C2C2C2C227D0AF60100002F2A2058504D202A2F0A73746174696320636861
72202A677261706869635B5D203D207B0A22313620313620392031222C0A222E
20632023383438343834222C0A222C2063204E6F6E65222C0A222D2063202346
4646464646222C0A222A20632023303030304646222C0A226120632023303030
303834222C0A226220632023303030303030222C0A2263206320233030383438
34222C0A226420632023433643364336222C0A22652063202346464646303022
2C0A222E2E2E2E2E2E2E2E2C2C2C2C2C2C2C2C222C0A222E2D2E2E2E2E2E2E2E
2E2C2C2C2C2C2C222C0A222E2D2E2D2E2E2E2E2E2E2E2E2C2C2A61222C0A222E
2D2E2D2E2D2D2D2D2D2D2E622A6361222C0A222E2D2E2D2E2D2D2D2D2D2D2E2A
63612C222C0A222E2D2E2D2E2D2D2D2D2D2D2A6361622C222C0A222E2D2E2D2E
2D2D2D2D2D2A636164622C222C0A222E2D2E2D2E2D2D2D2D2A63616464622C22
2C0A222E2D2E2D2E2D2D2D2A63612D2D64622C222C0A222E2D2E2D2E2D2D2E65
612D2D2D64622C222C0A222E2D2E2D2E2D2D642E2D2D2D2D64622C222C0A222E
642E2D2E2D622E2D2D2D2D2D64622C222C0A2262622E642E2D2D2D2D2D2D2D2D
64622C222C0A222C2C62622E646464646464646464622C222C0A222C2C2C2C62
626262626262626262622C222C0A222C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C22
7D0A8D0100002F2A2058504D202A2F0A7374617469632063686172202A677261
706869635B5D203D207B0A22313620313620322031222C0A222E2063204E6F6E
65222C0A222C20632023303030303030222C0A222E2E2E2E2E2E2E2E2E2E2E2E
2E2E2E2E222C0A222E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2C2E
2E2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2C2C2E2E2E2E2E2E2E2E2E2E2E2E
222C0A222E2E2C2C2C2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2C2C2C2C2E2E
2E2E2E2E2E2E2E2E222C0A222E2E2C2C2C2C2C2E2E2E2E2E2E2E2E2E222C0A22
2E2E2C2C2C2C2C2C2E2E2E2E2E2E2E2E222C0A222E2E2C2C2C2C2C2C2C2E2E2E
2E2E2E2E222C0A222E2E2C2C2C2C2C2C2E2E2E2E2E2E2E2E222C0A222E2E2C2C
2C2C2C2E2E2E2E2E2E2E2E2E222C0A222E2E2C2C2C2C2E2E2E2E2E2E2E2E2E2E
222C0A222E2E2C2C2C2E2E2E2E2E2E2E2E2E2E2E222C0A222E2E2C2C2E2E2E2E
2E2E2E2E2E2E2E2E222C0A222E2E2C2E2E2E2E2E2E2E2E2E2E2E2E2E222C0A22
2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E227D0A
}
end
end

View File

@ -0,0 +1,252 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3'['#1#6'Height'#3'?'#2#3'Top'#3'/'#1
+#5'Width'#3#22#3#18'HorzScrollBar.Page'#3#21#3#18'VertScrollBar.Page'#3'>'#2
+#13'ActiveControl'#7#7'Button1'#7'Caption'#6',Demo for drag''n drop and clip'
+'board transfers'#12'Font.CharSet'#7#12'ANSI_CHARSET'#11'Font.Height'#2#244#9
+'Font.Name'#6#5'Arial'#8'OnCreate'#7#10'FormCreate'#7'Visible'#9#0#6'TLabel'
+#6'Label1'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'`'#5'Width'#3#239#0#7'Captio'
+'n'#6'1Tree 1 uses OLE when initiating a drag operation.'#5'Color'#7#6'clNon'
+'e'#12'Font.CharSet'#7#12'ANSI_CHARSET'#11'Font.Height'#2#245#9'Font.Name'#6
+#5'Arial'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#3'h'#1#6'Height'
+#2'!'#3'Top'#2'P'#5'Width'#3'Q'#1#8'AutoSize'#8#7'Caption'#6#137'Tree 2 uses'
+' VCL when initiating a drag operation. It also uses manual drag mode. Only '
+'marked lines are allowed to start a drag operation.'#5'Color'#7#6'clNone'#12
+'Font.CharSet'#7#12'ANSI_CHARSET'#11'Font.Height'#2#245#9'Font.Name'#6#5'Ari'
+'al'#11'ParentColor'#8#8'WordWrap'#9#0#0#6'TPanel'#6'Panel3'#6'Height'#2'E'#5
+'Width'#3#22#3#5'Align'#7#5'alTop'#5'Color'#7#7'clWhite'#11'ParentColor'#8#8
+'TabOrder'#2#0#0#6'TLabel'#6'Label6'#4'Left'#2'$'#6'Height'#2'*'#3'Top'#2#15
+#5'Width'#3#17#1#8'AutoSize'#8#7'Caption'#6'PThis demo shows how to cope wit'
+'h OLE drag''n drop as well as cut, copy and paste.'#5'Color'#7#6'clNone'#12
+'Font.CharSet'#7#12'ANSI_CHARSET'#11'Font.Height'#2#244#9'Font.Name'#6#5'Ari'
+'al'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#8'WordWrap'#9#0#0#0#7'T'
+'Button'#7'Button1'#4'Left'#3#193#2#6'Height'#2#25#3'Top'#3#15#2#5'Width'#2
+'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4
+#7'Caption'#6#5'Close'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#1#0#0#7'T'
+'Button'#7'Button3'#4'Left'#3#197#2#6'Height'#2#25#3'Top'#2'P'#5'Width'#2'K'
+#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#7'Cap'
+'tion'#6#12'Tree font...'#7'OnClick'#7#12'Button3Click'#14'ParentShowHint'#8
+#8'TabOrder'#2#2#0#0#18'TVirtualStringTree'#5'Tree2'#4'Left'#3'l'#1#6'Height'
+#3#180#0#3'Top'#2't'#5'Width'#3'J'#1#24'ClipboardFormats.Strings'#1#6#10'Pla'
+'in text'#6#12'Unicode text'#6#17'Virtual Tree Data'#0#18'Colors.BorderColor'
+#7#12'clWindowText'#15'Colors.HotColor'#7#7'clBlack'#17'DefaultNodeHeight'#2
+#24#14'DragOperations'#11#6'doCopy'#6'doMove'#6'doLink'#0#8'DragType'#7#5'dt'
+'VCL'#9'DragWidth'#3'^'#1#9'EditDelay'#3#244#1#12'Font.CharSet'#7#12'ANSI_CH'
+'ARSET'#11'Font.Height'#2#245#9'Font.Name'#6#19'Lucida Sans Unicode'#18'Head'
+'er.Font.Height'#2#245#16'Header.Font.Name'#6#13'MS Sans Serif'#17'Header.Ma'
+'inColumn'#2#255#14'Header.Options'#11#14'hoColumnResize'#6'hoDrag'#0#8'Hint'
+'Mode'#7#9'hmTooltip'#14'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#3#28
+'TreeOptions.AnimationOptions'#11#16'toAnimatedToggle'#0#23'TreeOptions.Auto'
+'Options'#11#16'toAutoDropExpand'#12'toAutoScroll'#20'toAutoScrollOnExpand'
+#22'toAutoTristateTracking'#17'toAutoHideButtons'#0#23'TreeOptions.MiscOptio'
+'ns'#11#15'toAcceptOLEDrop'#12'toInitOnSave'#18'toToggleOnDblClick'#14'toWhe'
+'elPanning'#0#28'TreeOptions.SelectionOptions'#11#13'toMultiSelect'#22'toCen'
+'terScrollIntoView'#0#17'OnBeforeItemErase'#7#20'Tree2BeforeItemErase'#13'On'
+'DragAllowed'#7#16'Tree2DragAllowed'#10'OnDragOver'#7#12'TreeDragOver'#10'On'
+'DragDrop'#7#12'TreeDragDrop'#9'OnGetText'#7#12'Tree1GetText'#10'OnInitNode'
+#7#12'TreeInitNode'#9'OnNewText'#7#12'Tree1NewText'#7'Columns'#14#0#0#0#18'T'
+'VirtualStringTree'#5'Tree1'#4'Left'#2#10#6'Height'#3#180#0#3'Top'#2't'#5'Wi'
+'dth'#3'J'#1#24'ClipboardFormats.Strings'#1#6#3'CSV'#6#11'HTML Format'#6#10
+'Plain text'#6#16'Rich Text Format'#6' Rich Text Format Without Objects'#6#12
+'Unicode text'#0#18'Colors.BorderColor'#7#12'clWindowText'#15'Colors.HotColo'
+'r'#7#7'clBlack'#17'DefaultNodeHeight'#2#24#8'DragMode'#7#11'dmAutomatic'#9
+'DragWidth'#3'^'#1#9'EditDelay'#3#244#1#12'Font.CharSet'#7#12'ANSI_CHARSET'
+#11'Font.Height'#2#245#9'Font.Name'#6#7'Verdana'#18'Header.Font.Height'#2#245
+#16'Header.Font.Name'#6#13'MS Sans Serif'#17'Header.MainColumn'#2#255#14'Hea'
+'der.Options'#11#14'hoColumnResize'#6'hoDrag'#0#8'HintMode'#7#9'hmTooltip'#6
+'Images'#7#10'TreeImages'#14'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#4
+#28'TreeOptions.AnimationOptions'#11#16'toAnimatedToggle'#0#23'TreeOptions.A'
+'utoOptions'#11#16'toAutoDropExpand'#12'toAutoScroll'#20'toAutoScrollOnExpan'
+'d'#22'toAutoTristateTracking'#17'toAutoHideButtons'#22'toAutoDeleteMovedNod'
+'es'#0#23'TreeOptions.MiscOptions'#11#15'toAcceptOLEDrop'#12'toInitOnSave'#18
+'toToggleOnDblClick'#14'toWheelPanning'#0#28'TreeOptions.SelectionOptions'#11
+#13'toMultiSelect'#0#10'OnDragOver'#7#12'TreeDragOver'#10'OnDragDrop'#7#12'T'
+'reeDragDrop'#9'OnGetText'#7#12'Tree1GetText'#10'OnInitNode'#7#12'TreeInitNo'
+'de'#9'OnNewText'#7#12'Tree1NewText'#7'Columns'#14#0#0#0#12'TPageControl'#12
+'PageControl1'#4'Left'#2#12#6'Height'#3#245#0#3'Top'#3'4'#1#5'Width'#3#173#2
,#10'ActivePage'#7#9'TabSheet1'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0
+#8'TabIndex'#2#3#8'TabOrder'#2#5#0#9'TTabSheet'#16'RichTextTabSheet'#7'Capti'
+'on'#6#9'Rich text'#10'ImageIndex'#2#1#0#6'TLabel'#6'Label3'#4'Left'#2#8#6'H'
+'eight'#2#15#3'Top'#2#8#5'Width'#3#197#1#7'Caption'#6'WYou can use the rich '
+'edit control as source and as target. It initiates OLE drag'' drop.'#5'Colo'
+'r'#7#6'clNone'#11'ParentColor'#8#0#0#0#9'TTabSheet'#11'LogTabSheet'#7'Capti'
+'on'#6#25'Drag''n drop operation log'#0#6'TLabel'#6'Label7'#4'Left'#2#6#6'He'
+'ight'#2')'#3'Top'#2#8#5'Width'#3#147#1#8'AutoSize'#8#7'Caption'#6'zThe log '
+'below shows textual representations of the operation carried out. You can a'
+'lso use the control as VCL drag source.'#5'Color'#7#6'clNone'#11'ParentColo'
+'r'#8#8'WordWrap'#9#0#0#8'TListBox'#10'LogListBox'#4'Left'#2#4#6'Height'#3
+#145#0#4'Hint'#6'/Use the list box to initiate a VCL drag''n drop.'#3'Top'#2
+'8'#5'Width'#3#149#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'
+#0#8'DragMode'#7#11'dmAutomatic'#10'ItemHeight'#2#15#14'ParentShowHint'#8#8
+'ShowHint'#9#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3'N'#2#6'Heig'
+'ht'#2#25#3'Top'#2#10#5'Width'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'B'
+'orderSpacing.InnerBorder'#2#4#7'Caption'#6#9'Clear log'#7'OnClick'#7#12'But'
+'ton2Click'#8'TabOrder'#2#1#0#0#0#9'TTabSheet'#9'TabSheet2'#7'Caption'#6#9'M'
+'ore info'#10'ImageIndex'#2#3#0#6'TLabel'#6'Label4'#4'Left'#2#12#6'Height'#2
+'%'#3'Top'#2'4'#5'Width'#3#137#2#8'AutoSize'#8#7'Caption'#6#209'For drag''n '
+'drop however it can (mainly for compatibility) either use OLE or VCL for dr'
+'ag operations. Since both approaches are incompatible and cannot be used to'
+'gether only one of them can be active at a time.'#5'Color'#7#6'clNone'#11'P'
+'arentColor'#8#8'WordWrap'#9#0#0#6'TLabel'#6'Label5'#4'Left'#2#12#6'Height'#2
+#29#3'Top'#2'^'#5'Width'#3#141#2#8'AutoSize'#8#7'Caption'#6'xThis, though, a'
+'pplies only to the originator of a drag operation. The receiver can handle '
+'both situations simultanously.'#5'Color'#7#6'clNone'#11'ParentColor'#8#8'Wo'
+'rdWrap'#9#0#0#6'TLabel'#6'Label9'#4'Left'#2#12#6'Height'#2'!'#3'Top'#2#12#5
+'Width'#3'}'#2#8'AutoSize'#8#7'Caption'#6#174'Virtual Treeview always uses O'
+'LE for clipboard operations. Windows ensures that an IDataObject is always'
+' available, even if an application used the clipboard in the old way.'#5'Co'
+'lor'#7#6'clNone'#11'ParentColor'#8#8'WordWrap'#9#0#0#0#9'TTabSheet'#9'TabSh'
+'eet1'#7'Caption'#6#4'Tips'#10'ImageIndex'#2#2#0#6'TLabel'#6'Label8'#4'Left'
+#2#12#6'Height'#2'%'#3'Top'#2#16#5'Width'#3#141#2#8'AutoSize'#8#7'Caption'#6
+'rTry drag''n drop and clipboard operations also together with other applica'
+'tions like Word or the Internet Explorer.'#5'Color'#7#6'clNone'#11'ParentCo'
+'lor'#8#8'WordWrap'#9#0#0#6'TLabel'#7'Label10'#4'Left'#2#12#6'Height'#2'%'#3
+'Top'#2'0'#5'Width'#3#141#2#8'AutoSize'#8#7'Caption'#6#153'Also quite intere'
+'sting is to start more than one instance of this demo and drag data between'
+' these instances. This works however only for OLE drag'' drop.'#5'Color'#7#6
+'clNone'#11'ParentColor'#8#8'WordWrap'#9#0#0#0#0#11'TActionList'#11'ActionLi'
+'st1'#4'left'#3#212#2#3'top'#3#156#0#0#7'TAction'#9'CutAction'#7'Caption'#6#3
+'Cut'#18'DisableIfNoHandler'#9#9'OnExecute'#7#16'CutActionExecute'#8'ShortCu'
+'t'#3'X@'#0#0#7'TAction'#10'CopyAction'#7'Caption'#6#4'Copy'#18'DisableIfNoH'
+'andler'#9#9'OnExecute'#7#17'CopyActionExecute'#8'ShortCut'#3'C@'#0#0#7'TAct'
+'ion'#11'PasteAction'#7'Caption'#6#5'Paste'#18'DisableIfNoHandler'#9#9'OnExe'
+'cute'#7#18'PasteActionExecute'#8'ShortCut'#3'V@'#0#0#0#11'TFontDialog'#10'F'
+'ontDialog'#5'Title'#6#13'Select a font'#11'Font.Height'#2#245#9'Font.Name'#6
+#13'MS Sans Serif'#4'left'#3#244#2#3'top'#3#168#0#0#0#10'TImageList'#10'Tree'
+'Images'#4'left'#3#194#2#3'top'#3#212#0#6'Bitmap'#10#211#31#0#0'li'#18#0#0#0
+#16#0#0#0#16#0#0#0#156#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"1'
+'6 16 3 1",'#10'". c None",'#10'", c #840000",'#10'"- c #FFFFFF",'#10'".....'
+'...........",'#10'"................",'#10'".,,-........,,-.",'#10'".,,,,-..'
+'...,,-..",'#10'"..,,,,-...,,-...",'#10'"....,,,-.,-.....",'#10'".....,,,,,-'
+'.....",'#10'"......,,,-......",'#10'".....,,,,,-.....",'#10'"....,,,-.,,-..'
+'..",'#10'"...,,,-...,,-...",'#10'"..,,,-.....,-...",'#10'"..,,,-......,-.."'
+','#10'"...,-...........",'#10'".............,-.",'#10'"................"}'
+#10#156#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 3 1",'#10
+'". c None",'#10'", c #000000",'#10'"- c #FFFFFF",'#10'"................",'
+#10'"................",'#10'"...,,,,,,,,.....",'#10'"...,------,,....",'#10
+'"...,------,-,...",'#10'"...,------,,,,..",'#10'"...,---------,..",'#10'"..'
+'.,---------,..",'#10'"...,---------,..",'#10'"...,---------,..",'#10'"...,-'
+'--------,..",'#10'"...,---------,..",'#10'"...,---------,..",'#10'"...,----'
+'-----,..",'#10'"...,,,,,,,,,,,..",'#10'"................"}'#10#171#1#0#0'/*'
,' XPM */'#10'static char *graphic[] = {'#10'"16 16 4 1",'#10'". c None",'#10
+'", c #000000",'#10'"- c #FFFFFF",'#10'"* c #000084",'#10'"................"'
+','#10'"................",'#10'".,,,,,,.........",'#10'".,----,,........",'
+#10'".,----,-,.......",'#10'".,-,,-,******...",'#10'".,-----*----**..",'#10
+'".,-,,,,*----*-*.",'#10'".,-----*-,,-****",'#10'".,-,,,,*-------*",'#10'".,'
+'-----*-,,,,,-*",'#10'".,,,,,,*-------*",'#10'".......*-,,,,,-*",'#10'".....'
+'..*-------*",'#10'".......*********",'#10'"................"}'#10#216#1#0#0
+'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 7 1",'#10'". c None",'
+#10'", c #000000",'#10'"- c #FFFF00",'#10'"* c #848484",'#10'"a c #848400",'
+#10'"b c #000084",'#10'"c c #FFFFFF",'#10'"................",'#10'"......,,,'
+',......",'#10'"..,,,,,--,,,,,..",'#10'".,*a*,-,,-,a*a,.",'#10'".,a*,......,'
+'a*,.",'#10'".,*a,,,,,,,,*a,.",'#10'".,a*a*a*a*a*a*,.",'#10'".,*a*a*bbbbbbb,'
+'.",'#10'".,a*a*abcccccbb.",'#10'".,*a*a*bcccccbcb",'#10'".,a*a*abcbbbcbbb",'
+#10'".,*a*a*bcccccccb",'#10'".,a*a*abcbbbbbcb",'#10'"..,,,,,bcccccccb",'#10
+'".......bbbbbbbbb",'#10'"................"}'#10#186#1#0#0'/* XPM */'#10'sta'
+'tic char *graphic[] = {'#10'"16 16 5 1",'#10'". c #FFFF00",'#10'", c None",'
+#10'"- c #848484",'#10'"* c #000000",'#10'"a c #FFFFFF",'#10'".,,-.,,-***,,,'
+',,",'#10'"-.,-a,-.aa**,,,,",'#10'",-.-.-.aaa*a*,,,",'#10'",.-.a----a*aa*,,"'
+','#10'"---a..aaaa*****,",'#10'",,a-aa-**aaaaa*,",'#10'"-,,-.aaaaaaaaa*,",'
+#10'",,,-a*******aa*,",'#10'",,,*aaaaaaaaaa*,",'#10'",,,*a*******aa*,",'#10
+'",,,*aaaaaaaaaa*,",'#10'",,,*a*******aa*,",'#10'",,,*aaaaaaaaaa*,",'#10'",,'
+',*aaaaaaaaaa*,",'#10'",,,************,",'#10'",,,,,,,,,,,,,,,,"}'#10#201#1#0
+#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 6 1",'#10'". c None",'
+#10'", c #000084",'#10'"- c #FFFFFF",'#10'"* c #000000",'#10'"a c #848484",'
+#10'"b c #FFFF00",'#10'"................",'#10'",,,,,,,,,,,,,,..",'#10'",-,,'
+',,,,,,,,,,..",'#10'",,,,,,,,,,,,,*..",'#10'"*...*--------*..",'#10'"*...*--'
+'------*..",'#10'"*...*--aaa---*..",'#10'"*...*-a.b.a--*..",'#10'"*...*a.b.b'
+'aaaaa.",'#10'"*...*a--------a*",'#10'"*...*a-b.b.b.ba*",'#10'"*...*a-.b.b.b'
+'.a*",'#10'"*****a-b.b.b.ba*",'#10'".....aaaaaaaaaa*",'#10'"......**********'
+'",'#10'"................"}'#10#201#1#0#0'/* XPM */'#10'static char *graphic'
+'[] = {'#10'"16 16 6 1",'#10'". c None",'#10'", c #000084",'#10'"- c #000000'
+'",'#10'"* c #FFFFFF",'#10'"a c #848484",'#10'"b c #00FFFF",'#10'"..........'
+'......",'#10'"................",'#10'",,,,,,,,,.......",'#10'",,,,,,,,,....'
+'...",'#10'"-*******-.-.....",'#10'"-*aaaaa*-.--....",'#10'"-*******-.-b-...'
+'",'#10'"-*aa-------bb-..",'#10'"-***-bbbbbbbbb-.",'#10'"-----bbbbbbbbbb-",'
+#10'"....-bbbbbbbbb-.",'#10'"....-------bb-..",'#10'"..........-b-...",'#10
+'"..........--....",'#10'"..........-.....",'#10'"................"}'#10#171
+#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 4 1",'#10'". c No'
+'ne",'#10'", c #000000",'#10'"- c #000084",'#10'"* c #FFFFFF",'#10'"........'
+'........",'#10'".......,,,,,,.--",'#10'"......,......,--",'#10'".....,.,...'
+'...--",'#10'",,,,,.,.,.....--",'#10'",**,.,.,.,...,--",'#10'",*,.,*,.,.,,,.'
+'--",'#10'",**,***,.,*,...-",'#10'",*******,**,....",'#10'",**********,...."'
+','#10'",*,,*,,,,,*,....",'#10'",**********,....",'#10'",*,,*,,,,,*,....",'
+#10'",**********,....",'#10'",,,,,,,,,,,,....",'#10'"................"}'#10
+#246#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 9 1",'#10'". '
+'c None",'#10'", c #848484",'#10'"- c #0000FF",'#10'"* c #FFFFFF",'#10'"a c '
+'#008400",'#10'"b c #000000",'#10'"c c #FFFF00",'#10'"d c #008484",'#10'"e c'
+' #000084",'#10'".....,,,,,......",'#10'"...,,--*.abb....",'#10'"..,--.*.aaa'
+'ab...",'#10'".,-*.*,,,,,,,b..",'#10'".,--*.,***c*,,..",'#10'"b--.aa,*c***,*'
+',.",'#10'"b--aaa,***c*bbbb",'#10'"b--aaa,*cddd,*,b",'#10'"b---aa,*d*,ae*,b"'
+','#10'"b-----,*d,a-e*,b",'#10'".b----,*d---e*,b",'#10'".b----,*ceee,*,b",'
+#10'"..b---,***c***,b",'#10'"...bb-,*c***c*,b",'#10'".....b,,,,,,,,,b",'#10
+'"......bbbbbbbbbb"}'#10#156#1#0#0'/* XPM */'#10'static char *graphic[] = {'
+#10'"16 16 3 1",'#10'". c None",'#10'", c #FFFFFF",'#10'"- c #008400",'#10'"'
+'................",'#10'".,,,,,,,,,,,,,,.",'#10'".,,,,,,,-,,,,,,.",'#10'".,,'
+',,,,,--,,,,,.",'#10'".,,,,------,,,,.",'#10'".,,,-,,,--,,,,,.",'#10'".,,,-,'
+',,-,,,,,,.",'#10'".,,,-,,,,,,,,,,.",'#10'".,,,,,,,,,,-,,,.",'#10'".,,,,,,-,'
+',,-,,,.",'#10'".,,,,,--,,,-,,,.",'#10'".,,,,------,,,,.",'#10'".,,,,,--,,,,'
+',,,.",'#10'".,,,,,,-,,,,,,,.",'#10'".,,,,,,,,,,,,,,.",'#10'"...............'
+'."}'#10#186#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 5 1",'
+#10'". c None",'#10'", c #848484",'#10'"- c #000000",'#10'"* c #FFFFFF",'#10
+'"a c #000084",'#10'"................",'#10'".....,,,,,,-....",'#10'".....,*'
+'****-....",'#10'".....,*,,,,,,-..",'#10'"a....,*,*****-..",'#10'"aa...,*,*,'
+',,,,,-",'#10'"aaa..,*,*,*****-",'#10'"aaaa.,*,*,*aaa*-",'#10'"aaa..,*,*,***'
,'**-",'#10'"aa...--,*,*aaa*-",'#10'"a......,*,*****-",'#10'".......--,*aaa*-'
+'",'#10'".........,*****-",'#10'".........-------",'#10'"................",'
+#10'"................"}'#10#201#1#0#0'/* XPM */'#10'static char *graphic[] ='
+' {'#10'"16 16 6 1",'#10'". c None",'#10'", c #848484",'#10'"- c #FFFF00",'
+#10'"* c #C6C6C6",'#10'"a c #FFFFFF",'#10'"b c #000000",'#10'"..............'
+'..",'#10'"...,,,,,........",'#10'"..,-*-*-,.......",'#10'".,-*-*-*-,,,,,,."'
+','#10'".,aaaaaaaaaaaa,b",'#10'".,a-*-*-*-*-*-,b",'#10'".,a*-*-*-*-*-*,b",'
+#10'".,a-*-*-*-*-*-,b",'#10'".,a*-*-*-*-*-*,b",'#10'".,a-*-*-*-*-*-,b",'#10
+'".,a*-*-*-*-*-*,b",'#10'".,a-*-*-*-*-*-,b",'#10'".,,,,,,,,,,,,,,b",'#10'"..'
+'bbbbbbbbbbbbbb",'#10'"................",'#10'"................"}'#10#201#1#0
+#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 6 1",'#10'". c None",'
+#10'", c #848484",'#10'"- c #FFFFFF",'#10'"* c #FFFF00",'#10'"a c #C6C6C6",'
+#10'"b c #000000",'#10'"................",'#10'"...,,,,,........",'#10'"..,-'
+'----,.......",'#10'".,-*a*a*-,,,,,,.",'#10'".,-a*a*a------,b",'#10'".,-*a*a'
+'*a*a*a*,b",'#10'",,,,,,,,,,,,,*,b",'#10'",----------,,a,b",'#10'",-*a*a*a*a'
+'**b,,b",'#10'".,-*a*a*a*a*ab,b",'#10'".,-a*a*a*a*a*b,b",'#10'"..,-a*a*a*a**'
+',bb",'#10'"..,,,,,,,,,,,,,b",'#10'"...bbbbbbbbbbbbb",'#10'"................'
+'",'#10'"................"}'#10#186#1#0#0'/* XPM */'#10'static char *graphic'
+'[] = {'#10'"16 16 5 1",'#10'". c None",'#10'", c #848484",'#10'"- c #FFFFFF'
+'",'#10'"* c #000000",'#10'"a c #C6C6C6",'#10'"................",'#10'".,,,,'
+',,,,.......",'#10'".,------,*......",'#10'".,------,-*.....",'#10'".,------'
+',***....",'#10'".,------aaa*....",'#10'".,-------aa*....",'#10'".,--------a'
+'*....",'#10'".,--------a*....",'#10'".,--------a*....",'#10'".,--------a*..'
+'..",'#10'".,--------a*....",'#10'".,aaaaaaaaa*....",'#10'".***********...."'
+','#10'"................",'#10'"................"}'#10#246#1#0#0'/* XPM */'
+#10'static char *graphic[] = {'#10'"16 16 9 1",'#10'". c None",'#10'", c #84'
+'8484",'#10'"- c #FFFFFF",'#10'"* c #000000",'#10'"a c #0000FF",'#10'"b c #0'
+'00084",'#10'"c c #008484",'#10'"d c #C6C6C6",'#10'"e c #FFFF00",'#10'".....'
+'...........",'#10'".,,,,,,,,.......",'#10'".,------,*....ab",'#10'".,------'
+',-*..acb",'#10'".,------,***acb.",'#10'".,------dddacb..",'#10'".,-------da'
+'cb...",'#10'".,-------acb....",'#10'".,------acb*....",'#10'".,-----,ebd*..'
+'..",'#10'".,-----d,-d*....",'#10'".,----*,--d*....",'#10'".,ddddddddd*...."'
+','#10'".***********....",'#10'"................",'#10'"................"}'
+#10#186#1#0#0'/* XPM */'#10'static char *graphic[] = {'#10'"16 16 5 1",'#10
+'". c #848484",'#10'", c None",'#10'"- c #FFFFFF",'#10'"* c #000000",'#10'"a'
+' c #C6C6C6",'#10'"........,,,,,,,,",'#10'".-........,,,,,,",'#10'".-.-.....'
+'...,,,,",'#10'".-.-.------.*,,,",'#10'".-.-.------.-*,,",'#10'".-.-.------.'
+'***,",'#10'".-.-.------aaa*,",'#10'".-.-.-------aa*,",'#10'".-.-.--------a*'
+',",'#10'".-.-.--------a*,",'#10'".-.-.--------a*,",'#10'".a.-.--------a*,",'
+#10'"**.a.--------a*,",'#10'",,**.aaaaaaaaa*,",'#10'",,,,***********,",'#10
+'",,,,,,,,,,,,,,,,"}'#10#246#1#0#0'/* XPM */'#10'static char *graphic[] = {'
+#10'"16 16 9 1",'#10'". c #848484",'#10'", c None",'#10'"- c #FFFFFF",'#10'"'
+'* c #0000FF",'#10'"a c #000084",'#10'"b c #000000",'#10'"c c #008484",'#10
+'"d c #C6C6C6",'#10'"e c #FFFF00",'#10'"........,,,,,,,,",'#10'".-........,,'
+',,,,",'#10'".-.-........,,*a",'#10'".-.-.------.b*ca",'#10'".-.-.------.*ca'
+',",'#10'".-.-.------*cab,",'#10'".-.-.-----*cadb,",'#10'".-.-.----*caddb,",'
+#10'".-.-.---*ca--db,",'#10'".-.-.--.ea---db,",'#10'".-.-.--d.----db,",'#10
+'".d.-.-b.-----db,",'#10'"bb.d.--------db,",'#10'",,bb.dddddddddb,",'#10'",,'
+',,bbbbbbbbbbb,",'#10'",,,,,,,,,,,,,,,,"}'#10#141#1#0#0'/* XPM */'#10'static'
+' char *graphic[] = {'#10'"16 16 2 1",'#10'". c None",'#10'", c #000000",'#10
+'"................",'#10'"................",'#10'"..,.............",'#10'"..'
+',,............",'#10'"..,,,...........",'#10'"..,,,,..........",'#10'"..,,,'
+',,.........",'#10'"..,,,,,,........",'#10'"..,,,,,,,.......",'#10'"..,,,,,,'
+'........",'#10'"..,,,,,.........",'#10'"..,,,,..........",'#10'"..,,,......'
+'.....",'#10'"..,,............",'#10'"..,.............",'#10'"..............'
+'.."}'#10#0#0#0
]);

View File

@ -0,0 +1,678 @@
unit Main;
{$MODE Delphi}
// Virtual Treeview sample application demonstrating clipboard and drag'n drop operations.
// The treeview uses OLE for these operations but can also issue and accept VCL drag'n drop.
// Written by Mike Lischke.
interface
uses
Windows, LCLIntf, Messages, ActiveX, SysUtils, Forms, Dialogs, Graphics,
VirtualTrees, ActnList, ComCtrls, ExtCtrls, StdCtrls, Controls, Classes, Buttons,
ImgList, LResources;
type
TMainForm = class(TForm)
ActionList1: TActionList;
CutAction: TAction;
CopyAction: TAction;
PasteAction: TAction;
FontDialog: TFontDialog;
Panel3: TPanel;
Label6: TLabel;
Button1: TButton;
Button3: TButton;
Tree2: TVirtualStringTree;
Label1: TLabel;
Tree1: TVirtualStringTree;
Label2: TLabel;
PageControl1: TPageControl;
LogTabSheet: TTabSheet;
RichTextTabSheet: TTabSheet;
LogListBox: TListBox;
//RichEdit1: TRichEdit;
Label3: TLabel;
Label7: TLabel;
Button2: TButton;
TabSheet1: TTabSheet;
Label8: TLabel;
TabSheet2: TTabSheet;
Label4: TLabel;
Label5: TLabel;
Label9: TLabel;
Label10: TLabel;
TreeImages: TImageList;
procedure Button1Click(Sender: TObject);
procedure CutActionExecute(Sender: TObject);
procedure CopyActionExecute(Sender: TObject);
procedure PasteActionExecute(Sender: TObject);
procedure Tree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var Text: WideString);
procedure FormCreate(Sender: TObject);
procedure TreeDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject;
Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
procedure Button2Click(Sender: TObject);
procedure TreeInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode;
var InitialStates: TVirtualNodeInitStates);
procedure Tree1NewText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; Text: WideString);
procedure Button3Click(Sender: TObject);
procedure Tree2DragAllowed(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; var Allowed: Boolean);
procedure TreeDragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState; State: TDragState;
Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
procedure Tree2BeforeItemErase(Sender: TBaseVirtualTree; Canvas: TCanvas; Node: PVirtualNode; ItemRect: TRect;
var ItemColor: TColor; var EraseAction: TItemEraseAction);
private
procedure AddUnicodeText(DataObject: IDataObject; Target: TVirtualStringTree; Mode: TVTNodeAttachMode);
procedure AddVCLText(Target: TVirtualStringTree; const Text: WideString; Mode: TVTNodeAttachMode);
function FindCPFormatDescription(CPFormat: Word): string;
procedure InsertData(Sender: TVirtualStringTree; DataObject: IDataObject; Formats: TFormatArray; Effect: Integer;
Mode: TVTNodeAttachMode);
end;
var
MainForm: TMainForm;
//----------------------------------------------------------------------------------------------------------------------
implementation
uses
TypInfo, ShlObj{, UrlMon};
{$R Res\Extra.res} // Contains a little rich text for the rich edit control and a XP manifest.
type
PNodeData = ^TNodeData;
TNodeData = record
Caption: WideString;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Button1Click(Sender: TObject);
begin
Close;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.CutActionExecute(Sender: TObject);
begin
if ActiveControl = Tree1 then
Tree1.CutToClipboard
else
if ActiveControl = Tree2 then
Tree2.CutToClipboard
else;
//if ActiveControl = RichEdit1 then
// RichEdit1.CutToClipboard;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.CopyActionExecute(Sender: TObject);
begin
if ActiveControl = Tree1 then
Tree1.CopyToClipboard
else
if ActiveControl = Tree2 then
Tree2.CopyToClipboard
else;
//if ActiveControl = RichEdit1 then
// RichEdit1.CopyToClipboard;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.PasteActionExecute(Sender: TObject);
var
DataObject: IDataObject;
EnumFormat: IEnumFormatEtc;
Format: TFormatEtc;
Formats: TFormatArray;
Fetched: LongWord;
Tree: TVirtualStringTree;
begin
if ActiveControl is TVirtualStringTree then
begin
Tree := ActiveControl as TVirtualStringTree;
if LogListBox.Items.Count > 0 then
LogListBox.Items.Add('');
if ActiveControl = Tree1 then
LogListBox.Items.Add('----- Tree 1')
else
LogListBox.Items.Add('----- Tree 2');
if Tree.PasteFromClipboard then
LogListBox.Items.Add('Native tree data pasted.')
else
begin
LogListBox.Items.Add('Other data pasted.');
// Some other data was pasted. Enumerate the available formats and try to add the data.
// 1) Get a data object for the data.
OLEGetClipboard(DataObject);
// 2) Enumerate all offered formats and create a format array from it which can be used in InsertData.
if Succeeded(DataObject.EnumFormatEtc(DATADIR_GET, EnumFormat)) then
begin
EnumFormat.Reset;
while EnumFormat.Next(1, Format, Fetched) = S_OK do
begin
SetLength(Formats, Length(Formats) + 1);
Formats[High(Formats)] := Format.cfFormat;
end;
InsertData(Tree, DataObject, Formats, DROPEFFECT_COPY, Tree.DefaultPasteMode);
end;
end;
end
else;
//if ActiveControl = RichEdit1 then
// RichEdit1.PasteFromClipboard;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Tree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var Text: WideString);
var
Data: PNodeData;
begin
if TextType = ttNormal then
begin
Data := Sender.GetNodeData(Node);
Text := Data.Caption;
end
else
Text := '';
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.FormCreate(Sender: TObject);
var
Stream: TResourceStream;
begin
Tree1.NodeDataSize := SizeOf(TNodeData);
Tree1.RootNodeCount := 30;
Tree2.NodeDataSize := SizeOf(TNodeData);
Tree2.RootNodeCount := 30;
// There is a small RTF text stored in the resource to have something to display in the rich edit control.
{
Stream := TResourceStream.Create(HInstance, 'RTF', 'RCDATA');
try
RichEdit1.Lines.LoadFromStream(Stream);
finally
Stream.Free;
end;
}
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.AddUnicodeText(DataObject: IDataObject; Target: TVirtualStringTree; Mode: TVTNodeAttachMode);
// This method is called when the drop handler gets called with Unicode text as only
// understandable clipboard format. This text is retrieved and splitted in lines.
// Every line is then added as new node.
var
FormatEtc: TFormatEtc;
Medium: TStgMedium;
OLEData,
Head, Tail: PWideChar;
TargetNode,
Node: PVirtualNode;
Data: PNodeData;
begin
if Mode <> amNowhere then
begin
// fill the structure used to get the Unicode string
with FormatEtc do
begin
cfFormat := CF_UNICODETEXT;
// no specific target device
ptd := nil;
// normal content to render
dwAspect := DVASPECT_CONTENT;
// no specific page of multipage data
lindex := -1;
// pass the data via memory
tymed := TYMED_HGLOBAL;
end;
// Check if we can get the Unicode text data.
if DataObject.QueryGetData(FormatEtc) = S_OK then
begin
// Data is accessible so finally get a pointer to it
if DataObject.GetData(FormatEtc, Medium) = S_OK then
begin
OLEData := GlobalLock(Medium.hGlobal);
if Assigned(OLEData) then
begin
Target.BeginUpdate;
TargetNode := Target.DropTargetNode;
if TargetNode = nil then
TargetNode := Target.FocusedNode;
Head := OLEData;
try
while Head^ <> #0 do
begin
Tail := Head;
while not (Tail^ in [WideChar(#0), WideChar(#13), WideChar(#10), WideChar(#9)]) do
Inc(Tail);
if Head <> Tail then
begin
// add a new node if we got a non-empty caption
Node := Target.InsertNode(TargetNode, Mode);
Data := Target.GetNodeData(Node);
SetString(Data.Caption, Head, Tail - Head);
end;
// Skip any tab.
if Tail^ = #9 then
Inc(Tail);
// skip line separators
if Tail^ = #13 then
Inc(Tail);
if Tail^ = #10 then
Inc(Tail);
Head := Tail;
end;
finally
GlobalUnlock(Medium.hGlobal);
Target.EndUpdate;
end;
end;
// never forget to free the storage medium
ReleaseStgMedium(@Medium);
end;
end;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.AddVCLText(Target: TVirtualStringTree; const Text: WideString; Mode: TVTNodeAttachMode);
// This method is called when the drop handler gets called with a VCL drag source.
// The given text is retrieved and splitted in lines.
var
Head, Tail: PWideChar;
TargetNode,
Node: PVirtualNode;
Data: PNodeData;
begin
if Mode <> amNowhere then
begin
Target.BeginUpdate;
try
TargetNode := Target.DropTargetNode;
if TargetNode = nil then
TargetNode := Target.FocusedNode;
Head := PWideChar(Text);
while Head^ <> #0 do
begin
Tail := Head;
while not (Tail^ in [WideChar(#0), WideChar(#13), WideChar(#10)]) do
Inc(Tail);
if Head <> Tail then
begin
// add a new node if we got a non-empty caption
Node := Target.InsertNode(TargetNode, Mode);
Data := Target.GetNodeData(Node);
SetString(Data.Caption, Head, Tail - Head);
end;
// skip line separators
if Tail^ = #13 then
Inc(Tail);
if Tail^ = #10 then
Inc(Tail);
Head := Tail;
end;
finally
Target.EndUpdate;
end;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
function TMainForm.FindCPFormatDescription(CPFormat: Word): string;
var
Buffer: array[0..2048] of Char;
begin
// Try the formats support the by Virtual Treeview first.
Result := GetVTClipboardFormatDescription(CPFormat);
// Retrieve additional formats from system.
if Length(Result) = 0 then
begin
if GetClipboardFormatName(CPFormat, @Buffer, 2048) > 0 then
Result := ' - ' + Buffer
else
Result := Format(' - unknown format (%d)', [CPFormat]);
end
else
Result := ' - ' + Result;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.TreeDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject;
Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
//--------------- local function --------------------------------------------
procedure DetermineEffect;
// Determine the drop effect to use if the source is a Virtual Treeview.
begin
// In the case the source is a Virtual Treeview we know 'move' is the default if dragging within
// the same tree and copy if dragging to another tree. Set Effect accordingly.
if Shift = [] then
begin
// No modifier key, so use standard action.
if Source = Sender then
Effect := DROPEFFECT_MOVE
else
Effect := DROPEFFECT_COPY;
end
else
begin
// A modifier key is pressed, hence use this to determine action.
if (Shift = [ssAlt]) or (Shift = [ssCtrl, ssAlt]) then
Effect := DROPEFFECT_LINK
else
if Shift = [ssCtrl] then
Effect := DROPEFFECT_COPY
else
Effect := DROPEFFECT_MOVE;
end;
end;
//--------------- end local function ----------------------------------------
var
S: string;
Attachmode: TVTNodeAttachMode;
Nodes: TNodeArray;
I: Integer;
begin
Nodes := nil;
if LogListBox.Items.Count > 0 then
LogListBox.Items.Add('');
if Sender = Tree1 then
LogListBox.Items.Add('----- Tree 1')
else
LogListBox.Items.Add('----- Tree 2');
if DataObject = nil then
LogListBox.Items.Add('VCL drop arrived')
else
LogListBox.Items.Add('OLE drop arrived');
S := 'Drop actions allowed:';
if Boolean(DROPEFFECT_COPY and Effect) then
S := S + ' copy';
if Boolean(DROPEFFECT_MOVE and Effect) then
S := S + ' move';
if Boolean(DROPEFFECT_LINK and Effect) then
S := S + ' link';
LogListBox.Items.Add(S);
S := 'Drop mode: ' + GetEnumName(TypeInfo(TDropMode), Ord(Mode));
LogListBox.Items.Add(S);
// Translate the drop position into an node attach mode.
case Mode of
dmAbove:
AttachMode := amInsertBefore;
dmOnNode:
AttachMode := amAddChildLast;
dmBelow:
AttachMode := amInsertAfter;
else
AttachMode := amNowhere;
end;
if DataObject = nil then
begin
// VCL drag'n drop. Handling this requires detailed knowledge about the sender and its data. This is one reason
// why it was a bad decision by Borland to implement something own instead using the system's way.
// In this demo we have two known sources of VCL dd data: Tree2 and LogListBox.
if Source = Tree2 then
begin
// Since we know this is a Virtual Treeview we can ignore the drop event entirely and use VT mechanisms.
DetermineEffect;
Nodes := Tree2.GetSortedSelection(True);
if Effect = DROPEFFECT_COPY then
begin
for I := 0 to High(Nodes) do
Tree2.CopyTo(Nodes[I], Sender.DropTargetNode, AttachMode, False);
end
else
for I := 0 to High(Nodes) do
Tree2.MoveTo(Nodes[I], Sender.DropTargetNode, AttachMode, False);
end
else
begin
// One long string (one node) is added, containing all text currently in the list box.
AddVCLText(Sender as TVirtualStringTree, LogListBox.Items.CommaText, AttachMode);
LogListBox.Items.Add('List box data accepted as string.');
end;
end
else
begin
// OLE drag'n drop. Perform full processing.
LogListBox.Items.Add('There are ' + IntToStr(Length(Formats)) + ' formats available:');
// Determine action in advance even if we don't use the dropped data.
// Note: The Effect parameter is a variable which must be set to the action we
// will actually take, to notify the sender of the drag operation about remaining actions.
// This value determines what the caller will do after the method returns,
// e.g. if DROPEFFECT_MOVE is returned then the source data will be deleted.
if Source is TBaseVirtualTree then
begin
DetermineEffect;
end
else
// Prefer copy if allowed for every other drag source. Alone from Effect you cannot determine the standard action
// of the sender, but we assume if copy is allowed then it is also the standard action
// (e.g. as in TRichEdit).
if Boolean(Effect and DROPEFFECT_COPY) then
Effect := DROPEFFECT_COPY
else
Effect := DROPEFFECT_MOVE;
InsertData(Sender as TVirtualStringTree, DataObject, Formats, Effect, AttachMode);
end;
// scroll last added entry into view
LogListBox.ItemIndex := LogListBox.Items.Count - 1;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Button2Click(Sender: TObject);
begin
LogListBox.Clear;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.TreeInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode;
var InitialStates: TVirtualNodeInitStates);
var
Data: PNodeData;
begin
Data := Sender.GetNodeData(Node);
// set a generic caption only if there is not already one (e.g. from drag operations)
if Length(Data.Caption) = 0 then
Data.Caption := Format('Node Index %d', [Node.Index]);
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Tree1NewText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; Text: WideString);
var
Data: PNodeData;
// Tree1 as well as Tree2 use the soSaveCaptions StringOption which enables automatic caption store action
// when tree data is serialized into memory (e.g. for drag'n drop). Restoring the caption is done by triggering
// this event for each loaded node.
// This mechanism frees us from implementing a SaveNode and LoadNode event since we have only the caption to store.
begin
Data := Sender.GetNodeData(Node);
Data.Caption := Text;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Button3Click(Sender: TObject);
begin
with FontDialog do
begin
Font := Tree1.Font;
if Execute then
begin
Tree1.Font := Font;
Tree2.Font := Font;
end;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Tree2DragAllowed(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; var Allowed: Boolean);
// Tree 2 uses manual drag start to tell which node might be dragged.
begin
Allowed := Odd(Node.Index);
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.TreeDragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState; State: TDragState;
Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
begin
Accept := True;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.Tree2BeforeItemErase(Sender: TBaseVirtualTree; Canvas: TCanvas; Node: PVirtualNode; ItemRect: TRect;
var ItemColor: TColor; var EraseAction: TItemEraseAction);
// The second tree uses manual drag and we want to show the lines which are allowed to start a drag operation by
// a colored background.
begin
if Odd(Node.Index) then
begin
ItemColor := $FFEEEE;
EraseAction := eaColor;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.InsertData(Sender: TVirtualStringTree; DataObject: IDataObject; Formats: TFormatArray;
Effect: Integer; Mode: TVTNodeAttachMode);
var
FormatAccepted: Boolean;
I: Integer;
begin
// Go through each available format and see if we can make sense of it.
FormatAccepted := False;
for I := 0 to High(Formats) do
begin
case Formats[I] of
// standard clipboard formats
CF_UNICODETEXT:
begin
LogListBox.Items.Add(' - Unicode text');
// As demonstration for non-tree data here an implementation for Unicode text.
// Formats are placed in preferred order in the formats parameter. Hence if
// there is native tree data involved in this drop operation then it has been
// caught earlier in the loop and FormatAccepted is already True.
if not FormatAccepted then
begin
// Unicode text data was dropped (e.g. from RichEdit1) add this line by line
// as new nodes.
AddUnicodeText(DataObject, Sender as TVirtualStringTree, Mode);
LogListBox.Items.Add('+ Unicode accepted');
FormatAccepted := True;
end;
end;
else
if Formats[I] = CF_VIRTUALTREE then
begin
// this is our native tree format
LogListBox.Items.Add(' - native Virtual Treeview data');
if not FormatAccepted then
begin
Sender.ProcessDrop(DataObject, Sender.DropTargetNode, Effect, Mode);
LogListBox.Items.Add('+ native Virtual Treeview data accepted');
// Indicate that we found a format we accepted so the data is not used twice.
FormatAccepted := True;
end;
end
else
if Formats[I] = CF_VTREFERENCE then
LogListBox.Items.Add(' - Virtual Treeview reference')
else
begin
// Predefined, shell specific, MIME specific or application specific clipboard data.
LogListBox.Items.Add(FindCPFormatDescription(Formats[I]));
end;
end;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
initialization
{$i Main.lrs}
end.

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<Flags>
<AlwaysBuild Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="virtualtreeview_package"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="ole.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ole"/>
</Unit0>
<Unit1>
<Filename Value="Main.pas"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="Main.lrs"/>
<UnitName Value="Main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,18 @@
program ole;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ add your units here }, Main, virtualtreeview_package;
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.