Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cz_012273
MyDelphi
提交
56a39d4d
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 搜索 >>
提交
56a39d4d
编写于
10月 17, 2021
作者:
C
cz_012273
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
显示文件名不含路径,退出时清空memo内容
上级
63813e78
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
32 deletion
+17
-32
Unit1.fmx
Unit1.fmx
+2
-2
Unit1.pas
Unit1.pas
+13
-28
Unit2.pas
Unit2.pas
+2
-2
未找到文件。
Unit1.fmx
浏览文件 @
56a39d4d
...
...
@@ -27,8 +27,8 @@ object Form1: TForm1
Size.PlatformDefault = False
TabOrder = 0
OnMouseLeave = Memo1MouseLeave
Viewport.Width =
393
.000000000000000000
Viewport.Height = 4
65
.000000000000000000
Viewport.Width =
401
.000000000000000000
Viewport.Height = 4
73
.000000000000000000
end
object FileNew: TButton
StyledSettings = [Family, Style, FontColor]
...
...
Unit1.pas
浏览文件 @
56a39d4d
...
...
@@ -26,9 +26,6 @@ type
procedure
FileExitClick
(
Sender
:
TObject
);
procedure
Formshow
(
Sender
:
TObject
);
procedure
FormClose
(
Sender
:
TObject
;
var
Action
:
TCloseAction
);
//procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
// procedure FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
// Shift: TShiftState);
procedure
Memo1MouseLeave
(
Sender
:
TObject
);
...
...
@@ -43,8 +40,8 @@ type
procedure
SetFileName
(
const
FileName
:
String
);
procedure
PerformFileOpen
(
const
AFileName
:
string
);
procedure
ResultProc
(
AResult
:
Boolean
;
AFileName
:
string
);
procedure
ResultProc1
(
AResult
:
Boolean
;
AFileName
:
string
);
procedure
ResultProc
(
AResult
:
Boolean
;
AFileName
:
string
);
//打开参数过程
procedure
ResultProc1
(
AResult
:
Boolean
;
AFileName
:
string
);
//另存参数过程
public
...
...
@@ -102,7 +99,7 @@ end;
procedure
TForm1
.
ResultProc
(
AResult
:
Boolean
;
AFileName
:
string
);
//默认参数过程,打开用到
var
reader
:
TStreamReader
;
TextEncode
:
string
;
TextEncode
,
s
:
string
;
begin
if
AResult
then
begin
...
...
@@ -121,13 +118,14 @@ begin
Memo1
.
Lines
.
clear
;
//清空Memo1中原有内容
while
not
reader
.
EndOfStream
do
while
not
reader
.
EndOfStream
do
begin
Memo1
.
Lines
.
Add
(
reader
.
ReadLine
);
end
;
reader
.
Free
;
label1
.
text
:=
'当前文件:'
+
AFileName
;
//取文件名
s
:=
copy
(
AFileName
,
pos
(
'Documents/'
,
AFileName
)+
10
,
50
);
//取文件名(不带路径)
label1
.
text
:=
'当前文件:'
+
s
;
memo1
.
selstart
:=
0
;
//光标放最前面
end
;
end
;
...
...
@@ -135,7 +133,6 @@ end;
procedure
TForm1
.
ResultProc1
(
AResult
:
Boolean
;
AFileName
:
string
);
//默认参数过程1,另存用到
begin
if
AResult
then
//Memo1.Lines.Add(AFileName);
begin
Memo1
.
Lines
.
SaveToFile
(
AFileName
);
end
;
...
...
@@ -196,8 +193,12 @@ begin
begin
ToastConfirm
(
'再按一次退出程序.'
);
Action
:=
TCloseAction
.
caNone
;
end
;
end
else
Memo1
.
Lines
.
clear
;
FWantExit
:=
True
;
{$ENDIF}
end
;
...
...
@@ -206,7 +207,8 @@ procedure TForm1.Formshow(Sender: TObject); //form1
begin
SetFileName
(
sUntitled
);
label1
.
text
:=
'当前文件:'
+
sUntitled
;
label1
.
text
:=
'当前文件:'
+
sUntitled
+
'.txt'
;
memo1
.
height
:=
473
;
//将meno控件恢复到默认高度
end
;
...
...
@@ -264,23 +266,6 @@ begin
end
;
//procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; //按两次退出过程,不起作用?
// Shift: TShiftState);
//begin
//{$IFDEF ANDROID}
// if (Key = vkHardwareBack) then
// begin
// if not FWantExit then
// begin
// Key := 0;
// ToastConfirm('再按一次退出程序.');
// end else
// MainActivity.finish;
// FWantExit := True;
// end;
//{$ENDIF}
//end;
procedure
TForm1
.
AniToastFinish
(
Ani
:
TObject
);
//按两次退出提示框结束
begin
...
...
Unit2.pas
浏览文件 @
56a39d4d
...
...
@@ -173,7 +173,7 @@ var
i
,
j
:
Integer
;
s
,
s1
,
s2
:
string
;
begin
VertScrollBox1
.
height
:=
561
;
//恢复VertScrollBox控件默认高度
FileName
:=
System
.
IOUtils
.
Tpath
.
GetSharedDocumentsPath
+
'/mycalendar/calendar.txt'
;
j
:=
20
;
//首行位置
...
...
@@ -265,7 +265,7 @@ var
begin
i
:=
StrToIntdef
(
copy
(
Tcheckbox
(
sender
).
Name
,
6
,
2
),
0
);
i
:=
StrToIntdef
(
copy
(
Tcheckbox
(
sender
).
Name
,
6
,
2
),
0
);
//取checkbox控件序号
if
checkm
[
i
].
ischecked
=
true
then
begin
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录