LCL: renamed OnFilesDrop event to OnDropFiles

git-svn-id: trunk@11369 -
This commit is contained in:
tombo 2007-06-25 14:38:03 +00:00
parent 87d2069122
commit d7ae9d52d1
17 changed files with 101 additions and 95 deletions

16
.gitattributes vendored
View File

@ -1155,6 +1155,14 @@ examples/designerbaseclass/example/unit1.lfm svneol=native#text/plain
examples/designerbaseclass/example/unit1.lrs svneol=native#text/plain
examples/designerbaseclass/example/unit1.pas svneol=native#text/plain
examples/dlgform.pp svneol=native#text/pascal
examples/dropfiles/filesdrop.lpi svneol=native#text/plain
examples/dropfiles/filesdrop.lpr svneol=native#text/pascal
examples/dropfiles/unit1.lfm svneol=native#text/plain
examples/dropfiles/unit1.lrs svneol=native#text/plain
examples/dropfiles/unit1.pas svneol=native#text/pascal
examples/dropfiles/unit2.lfm svneol=native#text/plain
examples/dropfiles/unit2.lrs svneol=native#text/plain
examples/dropfiles/unit2.pas svneol=native#text/pascal
examples/easter/about.lfm svneol=native#text/plain
examples/easter/about.lrs svneol=native#text/pascal
examples/easter/about.pas svneol=native#text/pascal
@ -1171,14 +1179,6 @@ examples/exploremenu/exploreidemenu.pas svneol=native#text/plain
examples/exploremenu/frmexploremenu.lfm svneol=native#text/plain
examples/exploremenu/frmexploremenu.lrs svneol=native#text/plain
examples/exploremenu/frmexploremenu.pas svneol=native#text/plain
examples/filesdrop/filesdrop.lpi svneol=native#text/plain
examples/filesdrop/filesdrop.lpr svneol=native#text/pascal
examples/filesdrop/unit1.lfm svneol=native#text/plain
examples/filesdrop/unit1.lrs svneol=native#text/plain
examples/filesdrop/unit1.pas svneol=native#text/pascal
examples/filesdrop/unit2.lfm svneol=native#text/plain
examples/filesdrop/unit2.lrs svneol=native#text/plain
examples/filesdrop/unit2.pas svneol=native#text/pascal
examples/fontenum/fontenumeration.lpi svneol=native#text/plain
examples/fontenum/fontenumeration.lpr svneol=native#text/pascal
examples/fontenum/mainunit.lfm svneol=native#text/plain

2
.gitignore vendored
View File

@ -258,11 +258,11 @@ examples/designerbaseclass/example/units
examples/designerbaseclass/lib/*.bak
examples/designerbaseclass/lib/units
examples/designerbaseclass/units
examples/dropfiles/units[!!-~]*.bak
examples/easter/*.bak
examples/easter/units
examples/exploremenu/*.bak
examples/exploremenu/units
examples/filesdrop/units[!!-~]*.bak
examples/fontenum/*.bak
examples/fontenum/units
examples/grid_semaphor/*.bak

View File

@ -5,8 +5,9 @@
<Version Value="5"/>
<General>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="0"/>
<ActiveEditorIndexAtStart Value="1"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -45,8 +46,8 @@
<IsPartOfProject Value="True"/>
<ResourceFilename Value="unit1.lrs"/>
<UnitName Value="Unit1"/>
<CursorPos X="82" Y="48"/>
<TopLine Value="24"/>
<CursorPos X="41" Y="19"/>
<TopLine Value="13"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
@ -64,26 +65,22 @@
<IsPartOfProject Value="True"/>
<ResourceFilename Value="unit2.lrs"/>
<UnitName Value="Unit2"/>
<CursorPos X="89" Y="37"/>
<TopLine Value="17"/>
<CursorPos X="80" Y="16"/>
<TopLine Value="4"/>
<EditorIndex Value="1"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit3>
</Units>
<JumpHistory Count="3" HistoryIndex="2">
<JumpHistory Count="2" HistoryIndex="1">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="43" Column="9" TopLine="17"/>
<Caret Line="20" Column="5" TopLine="18"/>
</Position1>
<Position2>
<Filename Value="unit2.pas"/>
<Caret Line="28" Column="7" TopLine="13"/>
<Caret Line="17" Column="5" TopLine="16"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="38" Column="70" TopLine="27"/>
</Position3>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -5,10 +5,11 @@ object Form1: TForm1
Width = 701
HorzScrollBar.Page = 700
VertScrollBar.Page = 352
ActiveControl = Memo1
Caption = 'On Files Drop event example'
ClientHeight = 353
ClientWidth = 701
OnFilesDrop = FormFilesDrop
OnDropFiles = FormDropFiles
object Label1: TLabel
Left = 13
Height = 14
@ -32,7 +33,7 @@ object Form1: TForm1
HintPause = 500
HintShortCuts = True
ShowHint = True
OnFilesDrop = ApplicationProperties1FilesDrop
OnDropFiles = ApplicationProperties1DropFiles
left = 126
top = 300
end

View File

@ -0,0 +1,16 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'+'#1#6'Height'#3'a'#1#3'Top'#3#155#0#5'Wi'
+'dth'#3#189#2#18'HorzScrollBar.Page'#3#188#2#18'VertScrollBar.Page'#3'`'#1#13
+'ActiveControl'#7#5'Memo1'#7'Caption'#6#27'On Files Drop event example'#12'C'
+'lientHeight'#3'a'#1#11'ClientWidth'#3#189#2#11'OnDropFiles'#7#13'FormDropFi'
+'les'#0#6'TLabel'#6'Label1'#4'Left'#2#13#6'Height'#2#14#3'Top'#2#18#5'Width'
+#3'('#1#7'Caption'#6'>Drag and drop files on this form and see the results i'
+'n memo. '#11'ParentColor'#8#0#0#5'TMemo'#5'Memo1'#4'Left'#2#12#6'Height'#3
+#31#1#3'Top'#2'0'#5'Width'#3#154#2#10'ScrollBars'#7#10'ssVertical'#8'TabOrde'
+'r'#2#0#0#0#22'TApplicationProperties'#22'ApplicationProperties1'#17'Capture'
+'Exceptions'#9#9'HintColor'#7#8'clInfoBk'#13'HintHidePause'#3#196#9#9'HintPa'
+'use'#3#244#1#13'HintShortCuts'#9#8'ShowHint'#9#11'OnDropFiles'#7#31'Applica'
+'tionProperties1DropFiles'#4'left'#2'~'#3'top'#3','#1#0#0#0
]);

View File

@ -15,9 +15,9 @@ type
ApplicationProperties1: TApplicationProperties;
Label1: TLabel;
Memo1: TMemo;
procedure ApplicationProperties1FilesDrop(Sender: TObject;
procedure ApplicationProperties1DropFiles(Sender: TObject;
const FileNames: array of String);
procedure FormFilesDrop(Sender: TObject; const FileNames: array of String);
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
private
{ private declarations }
public
@ -31,16 +31,7 @@ implementation
{ TForm1 }
procedure TForm1.FormFilesDrop(Sender: TObject; const FileNames: array of String);
var
I: Integer;
begin
Memo1.Lines.Add(IntToStr(Length(FileNames)) + ' file(s) dropped on ' + Name + ':');
for I := 0 to High(FileNames) do
Memo1.Lines.Add(FileNames[I]);
end;
procedure TForm1.ApplicationProperties1FilesDrop(Sender: TObject;
procedure TForm1.ApplicationProperties1DropFiles(Sender: TObject;
const FileNames: array of String);
var
I: Integer;
@ -50,6 +41,15 @@ begin
Memo1.Lines.Add(FileNames[I]);
end;
procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of String);
var
I: Integer;
begin
Memo1.Lines.Add(IntToStr(Length(FileNames)) + ' file(s) dropped on ' + Name + ':');
for I := 0 to High(FileNames) do
Memo1.Lines.Add(FileNames[I]);
end;
initialization
{$I unit1.lrs}

View File

@ -8,7 +8,7 @@ object Form2: TForm2
Caption = 'Form2'
ClientHeight = 56
ClientWidth = 473
OnFilesDrop = FormFilesDrop
OnDropFiles = FormDropFiles
object Label1: TLabel
Left = 13
Height = 14

View File

@ -3,8 +3,8 @@
LazarusResources.Add('TForm2','FORMDATA',[
'TPF0'#6'TForm2'#5'Form2'#4'Left'#3#166#1#6'Height'#2'8'#3'Top'#3'P'#2#5'Widt'
+'h'#3#217#1#18'HorzScrollBar.Page'#3#216#1#18'VertScrollBar.Page'#2'7'#7'Cap'
+'tion'#6#5'Form2'#12'ClientHeight'#2'8'#11'ClientWidth'#3#217#1#11'OnFilesDr'
+'op'#7#13'FormFilesDrop'#0#6'TLabel'#6'Label1'#4'Left'#2#13#6'Height'#2#14#3
+'tion'#6#5'Form2'#12'ClientHeight'#2'8'#11'ClientWidth'#3#217#1#11'OnDropFil'
+'es'#7#13'FormDropFiles'#0#6'TLabel'#6'Label1'#4'Left'#2#13#6'Height'#2#14#3
+'Top'#2#18#5'Width'#3'('#1#7'Caption'#6'>Drag and drop files on this form an'
+'d see the results in memo. '#11'ParentColor'#8#0#0#0
]);

View File

@ -13,7 +13,7 @@ type
TForm2 = class(TForm)
Label1: TLabel;
procedure FormFilesDrop(Sender: TObject; const FileNames: array of String);
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
private
{ private declarations }
public
@ -30,7 +30,7 @@ uses
{ TForm2 }
procedure TForm2.FormFilesDrop(Sender: TObject; const FileNames: array of String);
procedure TForm2.FormDropFiles(Sender: TObject; const FileNames: array of String);
var
I: Integer;
begin

View File

@ -1,16 +0,0 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'+'#1#6'Height'#3'a'#1#3'Top'#3#155#0#5'Wi'
+'dth'#3#189#2#18'HorzScrollBar.Page'#3#188#2#18'VertScrollBar.Page'#3'`'#1#7
+'Caption'#6#27'On Files Drop event example'#12'ClientHeight'#3'a'#1#11'Clien'
+'tWidth'#3#189#2#11'OnFilesDrop'#7#13'FormFilesDrop'#0#6'TLabel'#6'Label1'#4
+'Left'#2#13#6'Height'#2#14#3'Top'#2#18#5'Width'#3'('#1#7'Caption'#6'>Drag an'
+'d drop files on this form and see the results in memo. '#11'ParentColor'#8#0
+#0#5'TMemo'#5'Memo1'#4'Left'#2#12#6'Height'#3#31#1#3'Top'#2'0'#5'Width'#3#154
+#2#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2#0#0#0#22'TApplicationProper'
+'ties'#22'ApplicationProperties1'#17'CaptureExceptions'#9#9'HintColor'#7#8'c'
+'lInfoBk'#13'HintHidePause'#3#196#9#9'HintPause'#3#244#1#13'HintShortCuts'#9
+#8'ShowHint'#9#11'OnFilesDrop'#7#31'ApplicationProperties1FilesDrop'#4'left'
+#2'~'#3'top'#3','#1#0#0#0
]);

View File

@ -319,7 +319,7 @@ type
THelpEvent = function(Command: Word; Data: Longint;
var CallHelp: Boolean): Boolean of object;
TFilesDropEvent = procedure (Sender: TObject; const FileNames: Array of String) of object;
TDropFilesEvent = procedure (Sender: TObject; const FileNames: Array of String) of object;
TShortCutEvent = procedure (var Msg: TLMKey; var Handled: Boolean) of object;
@ -373,7 +373,7 @@ type
FOnCreate: TNotifyEvent;
FOnDeactivate: TNotifyEvent;
FOnDestroy: TNotifyEvent;
FOnFilesDrop: TFilesDropEvent;
FOnDropFiles: TDropFilesEvent;
FOnHelp: THelpEvent;
FOnHide: TNotifyEvent;
FOnShortcut: TShortCutEvent;
@ -501,7 +501,7 @@ type
procedure AddHandlerCreate(OnCreateHandler: TNotifyEvent; AsLast: Boolean=true);
procedure RemoveHandlerCreate(OnCreateHandler: TNotifyEvent);
function IsShortcut(var Message: TLMKey): boolean; virtual;
procedure IntfFilesDrop(const FileNames: Array of String);
procedure IntfDropFiles(const FileNames: Array of String);
procedure IntfHelp(AComponent: TComponent);
public
// drag and dock
@ -536,7 +536,7 @@ type
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnFilesDrop: TFilesDropEvent read FOnFilesDrop write FOnFilesDrop;
property OnDropFiles: TDropFilesEvent read FOnDropFiles write FOnDropFiles;
property OnHelp: THelpEvent read FOnHelp write FOnHelp;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
property OnResize stored IsForm;
@ -608,7 +608,7 @@ type
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnFilesDrop;
property OnDropFiles;
property OnGetSiteInfo;
property OnHide;
property OnKeyDown;
@ -928,7 +928,7 @@ type
FOnActivate: TNotifyEvent;
FOnDeactivate: TNotifyEvent;
FOnDestroy: TNotifyEvent;
FOnFilesDrop: TFilesDropEvent;
FOnDropFiles: TDropFilesEvent;
FOnHelp: THelpEvent;
FOnHint: TNotifyEvent;
FOnIdle: TIdleEvent;
@ -1062,7 +1062,7 @@ type
procedure IntfEndSession;
procedure IntfAppMinimize;
procedure IntfAppRestore;
procedure IntfFilesDrop(const FileNames: Array of String);
procedure IntfDropFiles(const FileNames: Array of String);
public
procedure DoEscapeKey(AControl: TWinControl; var Key: Word;
Shift: TShiftState);
@ -1095,7 +1095,7 @@ type
property OnQueryEndSession: TQueryEndSessionEvent read FOnQueryEndSession write FOnQueryEndSession;
property OnMinimize: TNotifyEvent read FOnMinimize write FOnMinimize;
property OnRestore: TNotifyEvent read FOnRestore write FOnRestore;
property OnFilesDrop: TFilesDropEvent read FOnFilesDrop write FOnFilesDrop;
property OnDropFiles: TDropFilesEvent read FOnDropFiles write FOnDropFiles;
property OnHelp: THelpEvent read FOnHelp write FOnHelp;
property OnHint: TNotifyEvent read FOnHint write FOnHint;
property OnShortcut: TShortcutEvent read FOnShortcut write FOnShortcut;
@ -1121,7 +1121,7 @@ type
FHintPause: Integer;
FHintShortCuts: Boolean;
FHintShortPause: Integer;
FOnFilesDrop: TFilesDropEvent;
FOnDropFiles: TDropFilesEvent;
FShowHint: Boolean;
FShowMainForm: Boolean;
FTitle: String;
@ -1157,7 +1157,7 @@ type
Procedure SetOnQueryEndSession(Const AValue : TQueryEndSessionEvent);
Procedure SetOnMinimize(Const AValue : TNotifyEvent);
Procedure SetOnRestore(Const AValue : TNotifyEvent);
Procedure SetOnFilesDrop(const AValue: TFilesDropEvent);
Procedure SetOnDropFiles(const AValue: TDropFilesEvent);
Procedure SetOnHelp(Const AValue : THelpEvent);
Procedure SetOnHint(Const AValue : TNotifyEvent);
Procedure SetOnShowHint(Const AValue : TShowHintEvent);
@ -1185,7 +1185,7 @@ type
property OnQueryEndSession : TQueryEndSessionEvent read FOnQueryEndSession write SetOnQueryEndSession;
property OnMinimize : TNotifyEvent read FOnMinimize write SetOnMinimize;
property OnRestore : TNotifyEvent read FOnRestore write SetOnRestore;
property OnFilesDrop: TFilesDropEvent read FOnFilesDrop write SetOnFilesDrop;
property OnDropFiles: TDropFilesEvent read FOnDropFiles write SetOnDropFiles;
property OnHelp: THelpEvent read FOnHelp write SetOnHelp;
property OnHint: TNotifyEvent read FOnHint write SetOnHint;
property OnShowHint: TShowHintEvent read FOnShowHint write SetOnShowHint;

View File

@ -1450,15 +1450,15 @@ begin
end;
{------------------------------------------------------------------------------
Method: TApplication.IntfFilesDrop
Method: TApplication.IntfDropFiles
Params: FileNames - Dropped files
Invokes OnFilesDropEvent of the application.
Invokes OnDropFilesEvent of the application.
This function is called by the interface.
------------------------------------------------------------------------------}
procedure TApplication.IntfFilesDrop(const FileNames: array of String);
procedure TApplication.IntfDropFiles(const FileNames: array of String);
begin
if Assigned(FOnFilesDrop) then FOnFilesDrop(Self, FileNames);
if Assigned(FOnDropFiles) then FOnDropFiles(Self, FileNames);
end;
{------------------------------------------------------------------------------

View File

@ -163,12 +163,12 @@ begin
Application.OnRestore := AValue;
end;
Procedure TApplicationProperties.SetOnFilesDrop(const AValue: TFilesDropEvent);
Procedure TApplicationProperties.SetOnDropFiles(const AValue: TDropFilesEvent);
begin
FOnFilesDrop := AValue;
FOnDropFiles := AValue;
If not (csDesigning in ComponentState) then
Application.OnFilesDrop := AValue;
Application.OnDropFiles := AValue;
end;
Procedure TApplicationProperties.SetOnHelp(Const AValue : THelpEvent);

View File

@ -1687,15 +1687,15 @@ begin
end;
{------------------------------------------------------------------------------
Method: TCustomForm.IntfFilesDrop
Method: TCustomForm.IntfDropFiles
Params: FileNames - Dropped files
Invokes OnFilesDropEvent of the form.
Invokes OnDropFilesEvent of the form.
This function is called by the interface.
------------------------------------------------------------------------------}
procedure TCustomForm.IntfFilesDrop(const FileNames: array of String);
procedure TCustomForm.IntfDropFiles(const FileNames: array of String);
begin
if Assigned(FOnFilesDrop) then FOnFilesDrop(Self, FileNames);
if Assigned(FOnDropFiles) then FOnDropFiles(Self, FileNames);
end;
{------------------------------------------------------------------------------

View File

@ -809,35 +809,43 @@ Var
procedure HandleSpinEditChange(ASpinEdit: TCustomFloatSpinEdit);
var
lWindowInfo: PWindowInfo;
lNewValue: single;
NewValue: single;
begin
lWindowInfo := GetWindowInfo(ASpinEdit.Handle);
if lWindowInfo = @DefaultWindowInfo then exit;
lNewValue := StrToFloatDef(ASpinEdit.Text, lWindowInfo^.spinValue);
if lNewValue <> lWindowInfo^.spinValue then
NewValue := StrToFloatDef(ASpinEdit.Text, lWindowInfo^.spinValue);
if (ASpinEdit.MaxValue > ASpinEdit.MinValue) then
begin
lWindowInfo^.spinValue := lNewValue;
LMessage.Msg := CM_TEXTCHANGED;
if NewValue > ASpinEdit.MaxValue then
NewValue := ASpinEdit.MaxValue;
if NewValue < ASpinEdit.MinValue then
NewValue := ASpinEdit.MinValue;
end;
lWindowInfo^.spinValue := NewValue;
LMessage.Msg := CM_TEXTCHANGED;
end;
procedure HandleSpinEditDeltaPos(AUpDownMsg: PNMUpDown);
var
lSpinEdit: TCustomFloatSpinEdit;
SpinEdit: TCustomFloatSpinEdit;
spinHandle: HWND;
newValue: single;
begin
lSpinEdit := TCustomFloatSpinEdit(WindowInfo^.WinControl);
newValue := WindowInfo^.spinValue + AUpDownMsg^.iDelta * lSpinEdit.Increment;
if (lSpinEdit.MinValue <> 0) or (lSpinEdit.MaxValue <> 0) then
SpinEdit := TCustomFloatSpinEdit(WindowInfo^.WinControl);
if SpinEdit.ReadOnly then Exit;
newValue := WindowInfo^.spinValue + AUpDownMsg^.iDelta * SpinEdit.Increment;
if (SpinEdit.MaxValue > SpinEdit.MinValue) then
begin
if newValue > lSpinEdit.MaxValue then
newValue := lSpinEdit.MaxValue;
if newValue < lSpinEdit.MinValue then
newValue := lSpinEdit.MinValue;
if newValue > SpinEdit.MaxValue then
newValue := SpinEdit.MaxValue;
if newValue < SpinEdit.MinValue then
newValue := SpinEdit.MinValue;
end;
spinHandle := AUpDownMsg^.hdr.hwndFrom;
UpdateFloatSpinEditText(spinHandle, NewValue, lSpinEdit.DecimalPlaces);
UpdateFloatSpinEditText(spinHandle, NewValue, SpinEdit.DecimalPlaces);
Windows.SendMessage(spinHandle, UDM_SETPOS32, 0, 500);
WindowInfo^.spinValue := newValue;
end;
@ -978,9 +986,9 @@ Var
if Length(Files) > 0 then
begin
if lWinControl is TCustomForm then
(lWinControl as TCustomForm).IntfFilesDrop(Files);
(lWinControl as TCustomForm).IntfDropFiles(Files);
if Application <> nil then
Application.IntfFilesDrop(Files);
Application.IntfDropFiles(Files);
end;
finally
DragFinish(Drop);

View File

@ -257,7 +257,7 @@ begin
FinishCreateWindow(AWinControl, Params, false);
// TODO: proper icon, for now set default icon
SetIcon(TCustomForm(AWinControl), 0);
// enable accepting files drop
// enable accepting drop files
DragAcceptFiles(Params.Window, True);
Result := Params.Window;
end;