diff --git a/.gitattributes b/.gitattributes index 45f5e2bdb5..467827a66e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6074,6 +6074,12 @@ test/customdrawn/cd_test_all.ico -text test/customdrawn/cd_test_all.lpi svneol=native#text/plain test/customdrawn/cd_test_all.lpr svneol=native#text/plain test/customdrawn/cd_test_all.res -text +test/customdrawn/lazdialogs_form.lfm svneol=native#text/plain +test/customdrawn/lazdialogs_form.pas svneol=native#text/plain +test/customdrawn/lazdialogs_test.ico -text +test/customdrawn/lazdialogs_test.lpi svneol=native#text/plain +test/customdrawn/lazdialogs_test.lpr svneol=native#text/plain +test/customdrawn/lazdialogs_test.res -text test/customdrawn/mainform.lfm svneol=native#text/plain test/customdrawn/mainform.pas svneol=native#text/plain test/hello.ahk svneol=native#text/plain diff --git a/test/customdrawn/lazdialogs_form.lfm b/test/customdrawn/lazdialogs_form.lfm new file mode 100644 index 0000000000..a5adaec673 --- /dev/null +++ b/test/customdrawn/lazdialogs_form.lfm @@ -0,0 +1,106 @@ +object Form1: TForm1 + Left = 315 + Height = 243 + Top = 183 + Width = 527 + Caption = 'Lazarus Dialogs Test' + ClientHeight = 243 + ClientWidth = 527 + LCLVersion = '0.9.31' + object buttonNativeOpen: TButton + Left = 16 + Height = 25 + Top = 24 + Width = 250 + Caption = 'Native TOpenDialog' + OnClick = buttonNativeOpenClick + TabOrder = 0 + end + object buttonLazOpen: TButton + Left = 16 + Height = 25 + Top = 60 + Width = 250 + Caption = 'TLazOpenDialog' + OnClick = buttonLazOpenClick + TabOrder = 1 + end + object buttonNativeSave: TButton + Left = 16 + Height = 25 + Top = 96 + Width = 250 + Caption = 'Native TSaveDialog' + OnClick = buttonNativeSaveClick + TabOrder = 2 + end + object buttonLazSave: TButton + Left = 16 + Height = 25 + Top = 136 + Width = 250 + Caption = 'TLazSaveDialog' + OnClick = buttonLazSaveClick + TabOrder = 3 + end + object buttonNativeSelectDir: TButton + Left = 16 + Height = 25 + Top = 173 + Width = 250 + Caption = 'Native TSelectDirectoryDialog' + OnClick = buttonNativeSelectDirClick + TabOrder = 4 + end + object buttonLazSelectDir: TButton + Left = 16 + Height = 25 + Top = 208 + Width = 250 + Caption = 'TLazSelectDirectoryDialog' + OnClick = buttonLazSelectDirClick + TabOrder = 5 + end + object Label1: TLabel + Left = 288 + Height = 17 + Top = 24 + Width = 100 + Caption = 'Input FileName:' + ParentColor = False + end + object editInputFileName: TEdit + Left = 288 + Height = 22 + Top = 48 + Width = 232 + TabOrder = 6 + end + object Label2: TLabel + Left = 288 + Height = 17 + Top = 136 + Width = 107 + Caption = 'Output FileName' + ParentColor = False + end + object editOutputFileName: TEdit + Left = 288 + Height = 22 + Top = 160 + Width = 232 + TabOrder = 7 + end + object dialogNativeOpen: TOpenDialog + left = 8 + top = 8 + end + object dialogNativeSave: TSaveDialog + left = 56 + top = 8 + end + object dialogNativeSelectDir: TSelectDirectoryDialog + left = 112 + top = 8 + end +end diff --git a/test/customdrawn/lazdialogs_form.pas b/test/customdrawn/lazdialogs_form.pas new file mode 100644 index 0000000000..7c0b6790e8 --- /dev/null +++ b/test/customdrawn/lazdialogs_form.pas @@ -0,0 +1,110 @@ +unit lazdialogs_form; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + ButtonPanel; + +type + + { TForm1 } + + TForm1 = class(TForm) + buttonNativeOpen: TButton; + buttonLazOpen: TButton; + buttonNativeSave: TButton; + buttonLazSave: TButton; + buttonNativeSelectDir: TButton; + buttonLazSelectDir: TButton; + dialogNativeOpen: TOpenDialog; + editInputFileName: TEdit; + editOutputFileName: TEdit; + Label1: TLabel; + Label2: TLabel; + dialogNativeSave: TSaveDialog; + dialogNativeSelectDir: TSelectDirectoryDialog; + procedure buttonLazSaveClick(Sender: TObject); + procedure buttonNativeOpenClick(Sender: TObject); + procedure buttonLazOpenClick(Sender: TObject); + procedure buttonLazSelectDirClick(Sender: TObject); + procedure buttonNativeSaveClick(Sender: TObject); + procedure buttonNativeSelectDirClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses lazdialogs; + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.buttonNativeOpenClick(Sender: TObject); +begin + dialogNativeOpen.Execute; +end; + +procedure TForm1.buttonLazSaveClick(Sender: TObject); +var + lDialog: TLazSaveDialog; +begin + lDialog := TLazSaveDialog.Create(nil); + try + lDialog.FileName := editInputFileName.Text; + lDialog.Execute; + editOutputFileName.Text := lDialog.FileName; + finally + lDialog.Free; + end; +end; + +procedure TForm1.buttonLazOpenClick(Sender: TObject); +var + lDialog: TLazOpenDialog; +begin + lDialog := TLazOpenDialog.Create(nil); + try + lDialog.FileName := editInputFileName.Text; + lDialog.Execute; + editOutputFileName.Text := lDialog.FileName; + finally + lDialog.Free; + end; +end; + +procedure TForm1.buttonLazSelectDirClick(Sender: TObject); +var + lDialog: TLazSelectDirectoryDialog; +begin + lDialog := TLazSelectDirectoryDialog.Create(nil); + try + lDialog.FileName := editInputFileName.Text; + lDialog.Execute; + editOutputFileName.Text := lDialog.FileName; + finally + lDialog.Free; + end; +end; + +procedure TForm1.buttonNativeSaveClick(Sender: TObject); +begin + dialogNativeSave.Execute; +end; + +procedure TForm1.buttonNativeSelectDirClick(Sender: TObject); +begin + dialogNativeSelectDir.Execute; +end; + +end. + diff --git a/test/customdrawn/lazdialogs_test.ico b/test/customdrawn/lazdialogs_test.ico new file mode 100644 index 0000000000..0341321b5d Binary files /dev/null and b/test/customdrawn/lazdialogs_test.ico differ diff --git a/test/customdrawn/lazdialogs_test.lpi b/test/customdrawn/lazdialogs_test.lpi new file mode 100644 index 0000000000..1c0071b541 --- /dev/null +++ b/test/customdrawn/lazdialogs_test.lpi @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/customdrawn/lazdialogs_test.lpr b/test/customdrawn/lazdialogs_test.lpr new file mode 100644 index 0000000000..424b510bda --- /dev/null +++ b/test/customdrawn/lazdialogs_test.lpr @@ -0,0 +1,22 @@ + +{$R *.res} + +program lazdialogs_test; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, lazdialogs_form + { you can add units after this }; + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/test/customdrawn/lazdialogs_test.res b/test/customdrawn/lazdialogs_test.res new file mode 100644 index 0000000000..7c6cf3e4be Binary files /dev/null and b/test/customdrawn/lazdialogs_test.res differ