Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cz_012273
MyDelphi
提交
1c37b28a
MyDelphi
项目概览
cz_012273
/
MyDelphi
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MyDelphi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1c37b28a
编写于
10月 12, 2021
作者:
cz_012273
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace MDialogs.pas
上级
40c60b39
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
49 deletion
+49
-49
MDialogs.pas
MDialogs.pas
+49
-49
未找到文件。
MDialogs.pas
浏览文件 @
1c37b28a
...
...
@@ -7,7 +7,7 @@
}
unit
MDialogs
;
unit
M
y
Dialogs
;
interface
...
...
@@ -20,7 +20,7 @@ uses
FMX
.
ListView
.
Adapters
.
Base
,
FMX
.
Controls
.
Presentation
;
type
TMOpenDialog
=
class
(
TForm
)
TM
y
OpenDialog
=
class
(
TForm
)
LVList
:
TListView
;
AniIndicator
:
TAniIndicator
;
SaveInput
:
TCalloutRectangle
;
...
...
@@ -122,9 +122,9 @@ type
property
MultiSelect
:
Boolean
read
FMultiSelect
write
FMultiSelect
;
end
;
TMSaveDialogClass
=
class
of
TMOpenDialog
;
TMSaveDialogClass
=
class
of
TM
y
OpenDialog
;
TMSaveDialog
=
class
(
TMOpenDialog
)
TMSaveDialog
=
class
(
TM
y
OpenDialog
)
protected
function
GetFileName
:
string
;
override
;
procedure
DoConfirm
;
override
;
...
...
@@ -151,7 +151,7 @@ uses
{$R *.LgXhdpiPh.fmx ANDROID}
function
GetDialog
(
AClass
:
TMSaveDialogClass
;
const
AInitialDir
:
string
;
const
AFilter
:
string
;
AFileFilter
:
TFunc
<
string
,
Boolean
>;
AFileNameComparer
:
IComparer
<
string
>):
TMOpenDialog
;
AFileFilter
:
TFunc
<
string
,
Boolean
>;
AFileNameComparer
:
IComparer
<
string
>):
TM
y
OpenDialog
;
begin
Result
:=
AClass
.
Create
(
nil
);
with
Result
do
...
...
@@ -169,7 +169,7 @@ procedure GetFileOpenDialog(AResultProc: TProc<Boolean, string>; const AInitialD
AFileNameComparer
:
IComparer
<
string
>);
begin
if
Assigned
(
AResultProc
)
then
with
GetDialog
(
TMOpenDialog
,
AInitialDir
,
AFilter
,
AFileFilter
,
AFileNameComparer
)
do
with
GetDialog
(
TM
y
OpenDialog
,
AInitialDir
,
AFilter
,
AFileFilter
,
AFileNameComparer
)
do
begin
MultiSelect
:=
AMultiSelect
;
Execute
(
AResultProc
);
...
...
@@ -188,7 +188,7 @@ procedure GetSelectDirectoryDialog(AResultProc: TProc<Boolean, string>; const AI
const
AFilter
:
string
;
AFileFilter
:
TFunc
<
string
,
Boolean
>;
AFileNameComparer
:
IComparer
<
string
>);
begin
if
Assigned
(
AResultProc
)
then
with
GetDialog
(
TMOpenDialog
,
AInitialDir
,
AFilter
,
AFileFilter
,
AFileNameComparer
)
do
with
GetDialog
(
TM
y
OpenDialog
,
AInitialDir
,
AFilter
,
AFileFilter
,
AFileNameComparer
)
do
begin
ListType
:=
TListType
.
ltDirectory
;
Execute
(
AResultProc
);
...
...
@@ -197,7 +197,7 @@ end;
{ TMOpenDialog }
procedure
TMOpenDialog
.
AddItemsToView
(
const
AItems
:
TStringDynArray
;
procedure
TM
y
OpenDialog
.
AddItemsToView
(
const
AItems
:
TStringDynArray
;
AListType
:
TListType
);
var
LItem
:
string
;
...
...
@@ -226,7 +226,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
SetIndicator
(
AShow
:
Boolean
);
procedure
TM
y
OpenDialog
.
SetIndicator
(
AShow
:
Boolean
);
begin
with
AniIndicator
do
begin
...
...
@@ -240,7 +240,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
SetItemImage
(
const
AItem
:
TListViewItem
);
procedure
TM
y
OpenDialog
.
SetItemImage
(
const
AItem
:
TListViewItem
);
begin
{ BMPList }
if
GetItemType
(
AItem
)
=
ltDirectory
then
...
...
@@ -249,32 +249,32 @@ begin
AItem
.
BitmapRef
:=
ImageFile
.
Bitmap
;
end
;
procedure
TMOpenDialog
.
BDirUpClick
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
BDirUpClick
(
Sender
:
TObject
);
begin
DoDirUp
;
end
;
procedure
TMOpenDialog
.
BRootClick
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
BRootClick
(
Sender
:
TObject
);
begin
DoDirToRoot
;
end
;
procedure
TMOpenDialog
.
BRootMouseEnter
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
BRootMouseEnter
(
Sender
:
TObject
);
begin
TFmxObject
(
Sender
).
AnimateColor
(
'Fill.Color'
,
TAlphaColorRec
.
Seagreen
);
end
;
procedure
TMOpenDialog
.
BRootMouseLeave
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
BRootMouseLeave
(
Sender
:
TObject
);
begin
TFmxObject
(
Sender
).
AnimateColor
(
'Fill.Color'
,
$
FF014051
);
end
;
class
constructor
TMOpenDialog
.
Create
;
class
constructor
TM
y
OpenDialog
.
Create
;
begin
BMPList
:=
TDictionary
<
string
,
TBitmap
>.
Create
;
end
;
constructor
TMOpenDialog
.
Create
(
AOwner
:
TComponent
);
constructor
TM
y
OpenDialog
.
Create
(
AOwner
:
TComponent
);
begin
inherited
;
FListType
:=
ltFile
;
...
...
@@ -309,19 +309,19 @@ begin
end
;
end
;
destructor
TMOpenDialog
.
Destroy
;
destructor
TM
y
OpenDialog
.
Destroy
;
begin
FItemSelectTimer
.
Free
;
FFilterList
.
Free
;
inherited
;
end
;
class
destructor
TMOpenDialog
.
Destroy
;
class
destructor
TM
y
OpenDialog
.
Destroy
;
begin
BMPList
.
Free
;
end
;
procedure
TMOpenDialog
.
DirChanged
;
procedure
TM
y
OpenDialog
.
DirChanged
;
begin
LVList
.
Selected
:=
nil
;
TextPath
.
Text
:=
FCurrentDir
;
...
...
@@ -330,13 +330,13 @@ begin
TextEmpty
.
Visible
:=
(
LVList
.
ItemCount
=
0
);
end
;
procedure
TMOpenDialog
.
DoCancel
;
procedure
TM
y
OpenDialog
.
DoCancel
;
begin
ModalResult
:=
mrCancel
;
close
;
end
;
procedure
TMOpenDialog
.
DoClose
(
var
CloseAction
:
TCloseAction
);
procedure
TM
y
OpenDialog
.
DoClose
(
var
CloseAction
:
TCloseAction
);
begin
inherited
;
CloseAction
:=
TCloseAction
.
caFree
;
...
...
@@ -352,7 +352,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
DoDirToRoot
;
procedure
TM
y
OpenDialog
.
DoDirToRoot
;
var
LDir
:
string
;
begin
...
...
@@ -365,7 +365,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
DoDirUp
;
procedure
TM
y
OpenDialog
.
DoDirUp
;
var
LParent
:
string
;
begin
...
...
@@ -378,7 +378,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
DoFileNameFiler
(
var
AArray
:
TStringDynArray
;
procedure
TM
y
OpenDialog
.
DoFileNameFiler
(
var
AArray
:
TStringDynArray
;
AFilterProc
:
TFunc
<
string
,
Boolean
>);
var
LTemp
:
TList
<
string
>;
...
...
@@ -397,7 +397,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
DoConfirm
;
procedure
TM
y
OpenDialog
.
DoConfirm
;
begin
if
(
(
FListType
=
ltFile
)
and
(
LVList
.
Selected
<>
nil
)
and
(
GetItemType
(
TListViewItem
(
LVList
.
Selected
))
=
ltFile
)
)
...
...
@@ -406,19 +406,19 @@ begin
ModalResult
:=
mrOK
;
end
;
procedure
TMOpenDialog
.
DoShow
;
procedure
TM
y
OpenDialog
.
DoShow
;
begin
inherited
;
LS
(
FCurrentDir
);
end
;
procedure
TMOpenDialog
.
DoTimerSelectItem
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
DoTimerSelectItem
(
Sender
:
TObject
);
begin
TTimer
(
Sender
).
Enabled
:=
False
;
LS
(
FCurrentDir
);
end
;
procedure
TMOpenDialog
.
ESaveNameMouseEnter
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
ESaveNameMouseEnter
(
Sender
:
TObject
);
begin
{ Delphi XE5 Version 19.0.13476.4176
Android: 有些输入法有隐藏键(如qq), 当虚拟键盘按下隐藏键后(不会触发
...
...
@@ -435,7 +435,7 @@ begin
{$ENDIF}
end
;
procedure
TMOpenDialog
.
Execute
(
const
AResultProc
:
TProc
<
Boolean
,
string
>);
procedure
TM
y
OpenDialog
.
Execute
(
const
AResultProc
:
TProc
<
Boolean
,
string
>);
var
LResult
:
Boolean
;
begin
...
...
@@ -458,7 +458,7 @@ begin
end
;
function
TMOpenDialog
.
DoFilter
(
AStr
:
string
):
Boolean
;
function
TM
y
OpenDialog
.
DoFilter
(
AStr
:
string
):
Boolean
;
function
ExtExist
(
const
AExt
:
string
):
Boolean
;
begin
...
...
@@ -472,31 +472,31 @@ begin
Result
:=
not
ExtExist
(
ExtractFileExt
(
ExtractFileName
(
AStr
)))
;
end
;
function
TMOpenDialog
.
GetDefaultDir
:
string
;
function
TM
y
OpenDialog
.
GetDefaultDir
:
string
;
begin
Result
:=
WithDelimiter
(
System
.
IOUtils
.
TPath
.
GetSharedDocumentsPath
);
end
;
function
TMOpenDialog
.
GetDefaultRootDir
:
string
;
function
TM
y
OpenDialog
.
GetDefaultRootDir
:
string
;
begin
Result
:=
WithDelimiter
(
TDirectory
.
GetDirectoryRoot
(
GetDefaultDir
));
end
;
function
TMOpenDialog
.
WithDelimiter
(
ADir
:
string
):
string
;
function
TM
y
OpenDialog
.
WithDelimiter
(
ADir
:
string
):
string
;
begin
Result
:=
ADir
;
if
RightStr
(
Result
,
1
)
<>
System
.
SysUtils
.
PathDelim
then
Result
:=
Result
+
System
.
SysUtils
.
PathDelim
;
end
;
function
TMOpenDialog
.
WithoutDelimiter
(
ADir
:
string
):
string
;
function
TM
y
OpenDialog
.
WithoutDelimiter
(
ADir
:
string
):
string
;
begin
Result
:=
ADir
;
if
RightStr
(
Result
,
1
)
=
System
.
SysUtils
.
PathDelim
then
Result
:=
Copy
(
Result
,
1
,
Result
.
Length
-
1
);
end
;
function
TMOpenDialog
.
GetFileNameComparer
:
IComparer
<
string
>;
function
TM
y
OpenDialog
.
GetFileNameComparer
:
IComparer
<
string
>;
begin
if
not
Assigned
(
FFileNameComparer
)
then
FFileNameComparer
:=
...
...
@@ -508,17 +508,17 @@ begin
Result
:=
FFileNameComparer
;
end
;
function
TMOpenDialog
.
GetFileNameFilter
:
TFunc
<
string
,
Boolean
>;
function
TM
y
OpenDialog
.
GetFileNameFilter
:
TFunc
<
string
,
Boolean
>;
begin
Result
:=
FFileNameFilter
;
end
;
function
TMOpenDialog
.
GetItemType
(
AItem
:
TListViewItem
):
TListType
;
function
TM
y
OpenDialog
.
GetItemType
(
AItem
:
TListViewItem
):
TListType
;
begin
Result
:=
TListType
(
AItem
.
Tag
);
end
;
function
TMOpenDialog
.
GetFileName
:
string
;
function
TM
y
OpenDialog
.
GetFileName
:
string
;
var
I
:
Integer
;
begin
...
...
@@ -545,7 +545,7 @@ begin
end
;
end
;
function
TMOpenDialog
.
GetListArray
(
const
ADir
:
string
;
function
TM
y
OpenDialog
.
GetListArray
(
const
ADir
:
string
;
AListType
:
TListType
):
TStringDynArray
;
var
LResult
:
TStringDynArray
;
...
...
@@ -575,17 +575,17 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
ListDirectories
(
const
ADir
:
string
);
procedure
TM
y
OpenDialog
.
ListDirectories
(
const
ADir
:
string
);
begin
AddItemsToView
(
GetListArray
(
ADir
,
ltDirectory
),
ltDirectory
);
end
;
procedure
TMOpenDialog
.
ListFiles
(
const
AParentDir
:
string
);
procedure
TM
y
OpenDialog
.
ListFiles
(
const
AParentDir
:
string
);
begin
AddItemsToView
(
GetListArray
(
AParentDir
,
ltFile
),
ltFile
);
end
;
procedure
TMOpenDialog
.
LS
(
const
ADir
:
string
);
procedure
TM
y
OpenDialog
.
LS
(
const
ADir
:
string
);
begin
if
not
DirectoryExists
(
ADir
)
then
Exit
;
...
...
@@ -610,7 +610,7 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
LVListItemClick
(
const
Sender
:
TObject
;
procedure
TM
y
OpenDialog
.
LVListItemClick
(
const
Sender
:
TObject
;
const
AItem
:
TListViewItem
);
var
LPath
:
string
;
...
...
@@ -638,12 +638,12 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
RCancelClick
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
RCancelClick
(
Sender
:
TObject
);
begin
DoCancel
;
end
;
procedure
TMOpenDialog
.
Resize
;
procedure
TM
y
OpenDialog
.
Resize
;
begin
inherited
;
...
...
@@ -665,12 +665,12 @@ begin
end
;
procedure
TMOpenDialog
.
ROKClick
(
Sender
:
TObject
);
procedure
TM
y
OpenDialog
.
ROKClick
(
Sender
:
TObject
);
begin
DoConfirm
;
end
;
procedure
TMOpenDialog
.
SetFilter
(
const
Value
:
string
);
procedure
TM
y
OpenDialog
.
SetFilter
(
const
Value
:
string
);
begin
//filter :='.txt=文本文件|.bmp=BMP文件';
FFilter
:=
Value
;
...
...
@@ -685,13 +685,13 @@ begin
end
;
end
;
procedure
TMOpenDialog
.
SetListType
(
const
Value
:
TListType
);
procedure
TM
y
OpenDialog
.
SetListType
(
const
Value
:
TListType
);
begin
if
FListType
<>
Value
then
FListType
:=
Value
;
end
;
procedure
TMOpenDialog
.
VirtualKeyboardChangeHandler
(
const
Sender
:
TObject
;
procedure
TM
y
OpenDialog
.
VirtualKeyboardChangeHandler
(
const
Sender
:
TObject
;
const
Msg
:
System
.
Messaging
.
TMessage
);
var
LTop
:
Single
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录