[MSEide-MSEgui-talk] Extended Tfilelistview.

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] Extended Tfilelistview.

fredvs
Hello Martin.

I try to get the infos of a tfilelistview to store into a tstringgrid to
have a "extended" filelist .

For this I did:

var
demogrid : tstringgrid;
list_files : tfilelistview;
...

demogrid.rowcount := list_files.filelist.count;

for x := 0 to list_files.filelist.count -1 do
begin
demogrid[0][x] := list_files.filelist.items[x].name;
demogrid[1][x] := fileext(list_files.filelist.items[x].name);
demogrid[2][x] := inttostr(list_files.filelist.items[x].extinfo1.size);
demogrid[3][x] :=
formatdatetime('YYYY-MM-DD',list_files.filelist.items[x].extinfo1.accesstime);
end;

The result is ok for demogrid[0][x] and demogrid[1][x].

But for demogrid[2][x] ---> 0 ---> for each file.

And for demogrid[3][x] ---> 1899-12-30 --> for each file.
Idem using modtime, accesstime or ctime --> 1899-12-30.

What is wrong ?

Thanks.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

mse
Administrator
On Monday 02 October 2017 15:55:25 fredvs wrote:

> Hello Martin.
>
> I try to get the infos of a tfilelistview to store into a tstringgrid to
> have a "extended" filelist .
>
> For this I did:
>
> var
> demogrid : tstringgrid;
> list_files : tfilelistview;
> ...
>
> demogrid.rowcount := list_files.filelist.count;
>
> for x := 0 to list_files.filelist.count -1 do
> begin
> demogrid[0][x] := list_files.filelist.items[x].name;
> demogrid[1][x] := fileext(list_files.filelist.items[x].name);
> demogrid[2][x] := inttostr(list_files.filelist.items[x].extinfo1.size);
> demogrid[3][x] :=
> formatdatetime('YYYY-MM-DD',list_files.filelist.items[x].extinfo1.accesstim
>e); end;
>
> The result is ok for demogrid[0][x] and demogrid[1][x].
>
> But for demogrid[2][x] ---> 0 ---> for each file.
>
> And for demogrid[3][x] ---> 1899-12-30 --> for each file.
> Idem using modtime, accesstime or ctime --> 1899-12-30.
>
> What is wrong ?
>
Use a tfiledatalist instead of a tfilelistview, in
tfiledatalist.adddirectory() set "ainfolevel" to "fil_ext1". Fetching file
size and accesstimes needs more time so it is not done by default
with "fil_name".

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

fredvs
Hello Martin.

I have excellent result with this:

var
x : integer;
datalist_files : tfiledatalist;
begin

datalist_files := tfiledatalist.create();

// This does not work --->
// datalist_files.mask := '"*.mp3" "*.wav" "*.ogg" "*.flac"';

datalist_files.adddirectory('/home/fred/mp3/Home cookin',fil_ext1);

datalist_files.options := [flo_sortname,flo_sorttype];

demogrid.rowcount := datalist_files.count;

for x := 0 to datalist_files.count -1 do
begin
demogrid[0][x] := datalist_files.items[x].name;
demogrid[1][x] := fileext(datalist_files.items[x].name);
demogrid[2][x] := inttostr(datalist_files.items[x].extinfo1.size div 1000) +
' kb';
demogrid[3][x] :=
formatdatetime('YYYY-MM-DD',datalist_files.items[x].extinfo1.ctime);
end;

end;

See picture:
<http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/mseextfilelist.png>

But how to apply a filter/mask ?

Thanks.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

mse
Administrator
On Wednesday 11 October 2017 03:08:19 fredvs wrote:

> var
> x : integer;
> datalist_files : tfiledatalist;
> begin
>
> datalist_files := tfiledatalist.create();
>
> // This does not work --->
> // datalist_files.mask := '"*.mp3" "*.wav" "*.ogg" "*.flac"';
>
> datalist_files.adddirectory('/home/fred/mp3/Home cookin',fil_ext1);
>
"
datalist_files.adddirectory('./',fil_ext1,'"*.mp3" "*.wav" "*.ogg" "*.flac"');
"

Tip: Ctrl+LeftClick in source editor on "adddirectory" shows the the header
definition:

"
   function adddirectory(const directoryname: filenamety;
        ainfolevel: fileinfolevelty = fil_name; const amask: filenamearty =
nil;
        const aincludeattrib: fileattributesty = [fa_all];
        const aexcludeattrib: fileattributesty = [];
        const aoptions: dirstreamoptionsty = [];
        const acheckproc: checkfileeventty = nil;
        const noexception: boolean = false): boolean; overload;
        //amask = nil -> all, true if ok
   function adddirectory(const directoryname: filenamety;
        ainfolevel: fileinfolevelty; const amask: filenamety;
        const aincludeattrib: fileattributesty = [fa_all];
        const aexcludeattrib: fileattributesty = [];
        const aoptions: dirstreamoptionsty = [];
        const acheckproc: checkfileeventty = nil;
        const noexception: boolean = false): boolean; overload;
        //amask = '' -> all, true if ok
"

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

fredvs
> datalist_files.adddirectory('./',fil_ext1,'"*.mp3" "*.wav" "*.ogg"
"*.flac"');

Perfect.

> Tip: Ctrl+LeftClick in source editor on "adddirectory" shows the the
> header definition:

Huh, I use it lot of time but... I have to admit that const amask was well
hidden.
I have to wash my glasses.

Many thanks Martin and, one more time, big wow for mse stringgrid..

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

mse
Administrator
On Thursday 12 October 2017 12:46:02 fredvs wrote:
>
> Many thanks Martin and, one more time, big wow for mse stringgrid..
>
If you want to show file icons twidgetgrid with inserted tdataicon,
tstringedit and tdatetimeedit probably is a better solution.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

fredvs
>If you want to show file icons twidgetgrid with inserted tdataicon,
> tstringedit and tdatetimeedit probably is a better solution.

Ha, ok, I will try.

But with mse stringgrid and his checkox feature ---> wow.

Perfect for a easy cue list (to enable/disable a file to mix).

See picture:
<http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/gridcheckbox.png>

And that stat file that keep all the data in the grid + checkox-state -->
wow.

Huh, do you have some advice how to do to save-load at run time that stat
file feature (and use it instead of a database-file).

Thanks.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Extended Tfilelistview.

mse
Administrator
On Friday 13 October 2017 00:15:29 fredvs wrote:
> Perfect for a easy cue list (to enable/disable a file to mix).
>
> See picture:
> <http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/gridcheckbox.png>
>
> And that stat file that keep all the data in the grid + checkox-state -->
> wow.
>
In a twidgetgrid place a tbooleanedit in order to get the same effect. Any
editwidget from component palette 'Edit' can be used in a twidgetgrid in
order to build a column of the corresponding data type.

> Huh, do you have some advice how to do to save-load at run time that stat
> file feature (and use it instead of a database-file).
>
tstatfile.readstat(), writestat().
"
   procedure readstat(const stream: ttextstream = nil); overload;
   procedure readstat(const afilename: filenamety); overload; //disk file
   procedure readstat(const aname: msestring;
                                     const statreader: tstatreader); overload;
   procedure writestat(const stream: ttextstream = nil); overload;
   procedure writestat(const afilename: filenamety); overload; //disk file
   procedure writestat(const aname: msestring;
                                     const statwriter: tstatwriter); overload;
"
Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk