返回“另存为”对话框 powerbuilder
Posted
技术标签:
【中文标题】返回“另存为”对话框 powerbuilder【英文标题】:Return to SaveAs Dialog Box powerbuilder 【发布时间】:2021-06-30 17:56:10 【问题描述】:我想将数据窗口信息导出到 .txt 文件。当我单击导出按钮时,将打开另存为对话框。如果存在同名的 .txt 文档,则会弹出 MessageBox 询问我是否要替换该文件。如果我按否,则另存为对话框正在关闭。如何防止另存为对话框关闭?我想返回它并为文件命名。
这是我的代码:
li_rc = GetFileSaveName (lcs_title, ls_path_filename, ls_filename, 'txt', 'TXT File (*.txt), *.txt' )
if li_rc > 0 then
if FileExists (ls_path_filename) then
//Existing file has been found
if MessageBox (lcs_title, 'Replace the file '+ ls_path_filename +'?', Question!, YesNo!, 1) = 2 then
//Do not replace the file
//Return to dialog?
else
//Replace the file
dw_1.SaveAs(ls_path_filename, Text!, false)
end if
end if
end if
谢谢!
【问题讨论】:
【参考方案1】:试试这个
boolean lb_need_file = true
do while lb_need_file
li_rc = GetFileSaveName (lcs_title, ls_path_filename, ls_filename, 'txt', 'TXT File (*.txt), *.txt' )
if li_rc > 0 then
if FileExists (ls_path_filename) then
//Existing file has been found
if MessageBox (lcs_title, 'Replace the file '+ ls_path_filename +'?', Question!, YesNo!, 1) = 2 then
//Do not replace the file
//Return to dialog?
else
lb_need_file = false
//Replace the file
dw_1.SaveAs(ls_path_filename, Text!, false)
end if
end if
end if
loop
如果这对您有用,请告诉我们
【讨论】:
以上是关于返回“另存为”对话框 powerbuilder的主要内容,如果未能解决你的问题,请参考以下文章