diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpgui_package.lpk | 30 | ||||
-rw-r--r-- | src/gui/gui_dialogs.pas | 28 | ||||
-rw-r--r-- | src/gui/gui_form.pas | 2 | ||||
-rw-r--r-- | src/gui/newdirdialog.inc | 62 |
4 files changed, 108 insertions, 14 deletions
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk index d61f9d2b..cb5391fa 100644 --- a/src/gui/fpgui_package.lpk +++ b/src/gui/fpgui_package.lpk @@ -32,7 +32,7 @@ <License Value="Modified LGPL "/> <Version Minor="6" Release="1"/> - <Files Count="29"> + <Files Count="30"> <Item1> <Filename Value="gui_button.pas"/> <UnitName Value="gui_button"/> @@ -134,31 +134,35 @@ <UnitName Value="fpgui_db"/> </Item25> <Item26> - <Filename Value="messagedialog.inc"/> - <Type Value="Binary"/> - </Item26> - <Item27> <Filename Value="gui_popupcalendar.pas"/> <UnitName Value="gui_popupcalendar"/> - </Item27> - <Item28> + </Item26> + <Item27> <Filename Value="gui_gauge.pas"/> <UnitName Value="gui_gauge"/> - </Item28> - <Item29> + </Item27> + <Item28> <Filename Value="gui_editcombo.pas"/> <UnitName Value="gui_editcombo"/> + </Item28> + <Item29> + <Filename Value="newdirdialog.inc"/> + <Type Value="Include"/> </Item29> + <Item30> + <Filename Value="messagedialog.inc"/> + <Type Value="Include"/> + </Item30> </Files> <LazDoc Paths="../../docs/xml/gui/"/> <RequiredPkgs Count="2"> <Item1> - <PackageName Value="FCL"/> - <MinVersion Major="1" Valid="True"/> - </Item1> - <Item2> <PackageName Value="fpgfx_package"/> <MinVersion Minor="6" Release="1" Valid="True"/> + </Item1> + <Item2> + <PackageName Value="FCL"/> + <MinVersion Major="1" Valid="True"/> </Item2> </RequiredPkgs> <UsageOptions> diff --git a/src/gui/gui_dialogs.pas b/src/gui/gui_dialogs.pas index e3b916fb..3c4bc214 100644 --- a/src/gui/gui_dialogs.pas +++ b/src/gui/gui_dialogs.pas @@ -160,6 +160,7 @@ type procedure FilterChange(Sender: TObject); procedure DirChange(Sender: TObject); procedure UpDirClick(Sender: TObject); + procedure btnDirNewClicked(Sender: TObject); procedure edFilenameChanged(Sender: TObject); procedure UpdateButtonState; protected @@ -185,6 +186,7 @@ type {$I messagedialog.inc} +{$I newdirdialog.inc} @@ -456,12 +458,14 @@ begin btnCancel.ImageName := 'stdimg.Cancel'; // Do NOT localize btnCancel.ShowImage := True; btnCancel.Anchors := [anRight, anBottom]; + btnCancel.TabOrder := 2; btnOK := CreateButton(self, btnCancel.Left-FDefaultButtonWidth-FSpacing, 370, FDefaultButtonWidth, rsOK, @btnOKClick); btnOK.Name := 'btnOK'; btnOK.ImageName := 'stdimg.OK'; // Do NOT localize btnOK.ShowImage := True; btnOK.Anchors := [anRight, anBottom]; + btnOK.TabOrder := 1; end; @@ -859,6 +863,7 @@ begin ImageName := 'stdimg.foldernew'; // Do NOT localize ModalResult := 0; Focusable := False; + OnClick := @btnDirNewClicked; end; btnShowHidden := TfpgButton.Create(self); @@ -1013,6 +1018,28 @@ begin SetCurrentDirectory('..'); end; +procedure TfpgFileDialog.btnDirNewClicked(Sender: TObject); +var + dlg: TfpgNewDirDialog; +begin + dlg := TfpgNewDirDialog.Create(nil); + try + if dlg.ShowModal = 1 then + begin + if dlg.Directory <> '' then + begin + ShowMessage(dlg.Directory); + mkdir(dlg.Directory); + grid.FileList.ReadDirectory(GetFileFilter, ShowHidden); + grid.FileList.Sort(soFileName); + grid.Invalidate; + end; + end; + finally + dlg.Free; + end; +end; + procedure TfpgFileDialog.edFilenameChanged(Sender: TObject); begin UpdateButtonState; @@ -1239,6 +1266,7 @@ end; {$I messagedialog.inc} +{$I newdirdialog.inc} end. diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas index b38cee83..71d72b51 100644 --- a/src/gui/gui_form.pas +++ b/src/gui/gui_form.pas @@ -209,7 +209,7 @@ begin FMinWidth := 32; FMinHeight := 32; FModalResult := 0; - FFullScreen := False; + FFullScreen := False; AfterCreate; end; diff --git a/src/gui/newdirdialog.inc b/src/gui/newdirdialog.inc new file mode 100644 index 00000000..0999e2ae --- /dev/null +++ b/src/gui/newdirdialog.inc @@ -0,0 +1,62 @@ + +{%mainunit gui_dialogs.pas} + +{$IFDEF read_interface} + + + { TfpgNewDirDialog } + + TfpgNewDirDialog = class(TfpgBaseDialog) + private + lblTitle: TfpgLabel; + edDirectory: TfpgEdit; + function GetDirectory: TfpgString; + public + constructor Create(AOwner: TComponent); override; + property Directory: TfpgString read GetDirectory; + end; + + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + +{ TfpgNewDirDialog } + +function TfpgNewDirDialog.GetDirectory: TfpgString; +begin + Result := edDirectory.Text; +end; + +constructor TfpgNewDirDialog.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + // reset dimensions + Width := 286; + Height := 97; + MinWidth := 286; + MinHeight := 97; + + lblTitle := CreateLabel(self, 8, 8, rsEnterNewDirectory); + edDirectory := CreateEdit(self, 8, 28, 270, 0); + edDirectory.Anchors := [anLeft, anTop, anRight]; + + // reposition buttons + btnCancel.Left := Width-FDefaultButtonWidth-FSpacing; + btnCancel.Top := Height - FSpacing - btnCancel.Height; + btnOK.Left := btnCancel.Left-FDefaultButtonWidth-FSpacing; + btnOK.Top := btnCancel.Top; + + // now reset tab order + edDirectory.TabOrder := 1; + btnOK.TabOrder := 2; + btnCancel.TabOrder := 3; +end; + + +{$ENDIF read_implementation} + + |