Thread Rating:
  • 478 Vote(s) - 2.96 Average
  • 1
  • 2
  • 3
  • 4
  • 5
choose-file で初期提案ファイル名を指定したい
09-11-2013, 06:12 PM,
#1
choose-file で初期提案ファイル名を指定したい
choose-file プロシージャで、初期提案値として、ファイル名を指定することはできないのでしょうか。

choose-file で表示されるダイアログは、下記の優先度で表示されるパスを決めている、という認識です。
①deafult-locaition で指定されたURL
②前回利用したフォルダ
③デスクトップ

deafult-locaition では、まだ存在しないファイルパスを指定しても、無視されてしまうので、困っています。

表示されるフォルダについては、この振舞いのまま、
ファイル名のフィールドに表示される文字列を、コール時に指定したいです。

内部的には、WindowsAPIを読んでいると思うので、Curlとして実装不可能、というわけではないと思いますが、
もし現時点では設定不可能、ということであれば、
次期バージョンアップ時に改善いただきたいです。

例:default-file-name で指定できる、など。


09-14-2013, 11:21 AM,
#2
RE: choose-file で初期提案ファイル名を指定したい
You should be able to choose the default filename if you include it in a full URL that you provide as the default-location argument. It is not selected in the dialog box, but it is pre-entered in the filename text field. Note that this only works if you are privileged or if running non-privileged if the Url is a PrivilegedUrl.
09-17-2013, 08:18 PM,
#3
RE: choose-file で初期提案ファイル名を指定したい
wbardwel さん

私の目的は、ユーザのPCの環境に依存せず、デフォルトのファイル名を表示したい、ということです。

これは、フォルダの指定をせず、ファイル名の指定のみを行いたい、という意味です。

現時点で、私は、dearult-locationを [c:\]を基底フォルダとして、設定しています。([c:\hoge.txt]のように)
多くのWindows ユーザーは、PCの中に [c:\] が存在するので、
これは多くの場合で、ファイル名を表示することに成功します。

しかし、この方法には、ファイルダイアログを表示するたびに、Cドライブが初期表示されてしまう、
というデメリットがあります。
多くの場合、ユーザは、前回保存したフォルダと同じフォルダを初期表示してほしいはずです。


It is my purpose that it does not depend on the environment of the user's PC, to display the file name of the default at file dialog.

It means without the specified folder, just specify the file name.

At the moment, my workaround is setting a path with a base drive name, like [c:/hoge.txt]

Most of Windows user's PC has C drive.
So, this way will be success in many cases, to display the file name at file dialog.

However, in this way, there is problem which it willbe display C drive initially , each time you show the file dialog.

Usualy, may user would expect to display the same folder where you saved last time initially.
09-23-2013, 10:06 AM,
#4
RE: choose-file で初期提案ファイル名を指定したい
If you are running a privileged applet I think that you can find out the directory that it will use and generate the proper Url using your desired filename. For an unprivileged applet, it was regarded as not safe to allow providing any information about a path that you have not already gotten permission to edit (which you show by having a PrivilegedUrl for the location.) (This is because users often just hit Enter, and the idea is to make sure an applet can't try to get permission to read or write a system file.)

09-24-2013, 10:14 AM, (This post was last modified: 09-24-2013, 10:24 AM by umemura.)
#5
RE: choose-file で初期提案ファイル名を指定したい
私は、このサンプルで、「hoge」というディレクトリがなくても、ファイルダイアログに「test.txt」というファイル名を表示したいです。
しかし、特権モードで動かしてもそのようには振舞いません。
(私はこのサンプルを、ローカルで動かしています。)

I would like to display on file dialog as "test.txt" , even if dosen't exist "hoge" directroy.
But this sample dosen't work , even running on a privileged.

Code:
{CommandButton
    {on Action do
        def du = {url "file:///c:/hoge/test.txt"}
        {if-non-null u = {choose-file
                             style = FileDialogStyle.save-as,
                             default-location = du
                         } then
            {popup-message u}
        }
    }
}

I use curl version is 8.0.2.

次にchoose-file プロシージャを読んだときに利用されるディレクトリのURLを取得できるのでしょうか。
そして、そのディレクトリに、自分の希望するファイル名をつなげてdefaurl-location として指定すれば、
私の希望する振舞いにすることができるのでしょうか。

You mean you can get directory url which curl's file dialog will use or generate when showing itself by called choose-file prosedure.
So, I can concat a file name to the directory url, and pass to chose-file prosedure as default-directory?

Do I misunderstand something?





10-25-2013, 03:27 PM, (This post was last modified: 01-24-2014, 01:04 PM by Sunny754569.)
#6
RE: choose-file で初期提案ファイル名を指定したい
共有していただきありがとうございます。


Possibly Related Threads...
Thread Author Replies Views Last Post
  choose-file の default-location が効かない umemura 2 3,391 04-08-2014, 07:48 PM
Last Post: umemura
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('967')