Recent

Author Topic: using filelistbox under win32  (Read 13332 times)

frederic

  • Full Member
  • ***
  • Posts: 226
using filelistbox under win32
« on: August 16, 2017, 11:21:28 am »
Hello
,this topic was already raised in 2006 on this forum;

I cannot get TFileListBox working under Win32 ( now Lazarus 1.6.4).:

This is what I have done:

I' ve put a TFileListBox on the form and  I've added in the OnClick event of a button (leaving everything else in the default settings):

 FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS';

I would expect the content of   'c:\users\public\STEPBYSTEPFILEFOLDERS  to be displayed in the TFileListBox, but it remains completely empty.

Has this issue not been solved yet or what am I doing wrong?
frederic

ASerge

  • Hero Member
  • *****
  • Posts: 2242
Re: using filelistbox under win32
« Reply #1 on: August 17, 2017, 01:39:47 am »
I' ve put a TFileListBox on the form and  I've added in the OnClick event of a button (leaving everything else in the default settings):

 FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS';

I would expect the content of   'c:\users\public\STEPBYSTEPFILEFOLDERS  to be displayed in the TFileListBox, but it remains completely empty.

Has this issue not been solved yet or what am I doing wrong?
And what's in FileListBox1.FileType? Perhaps in the specified directory there are simply no files with the appropriate attribute.

Almir.Bispo

  • Jr. Member
  • **
  • Posts: 91
  • CSV Comp DB is the Best NoSQL
    • CSV Comp DB (NoSQL)
Re: using filelistbox under win32
« Reply #2 on: August 17, 2017, 01:55:00 am »
FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS\'; //dont forget the slash at end
FileListBox1.mask:= '*.*'; //file tipe all but *.txt* ,*.csv* can be used
CSV Comp DB Developer {Pascal Lover}

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #3 on: August 17, 2017, 09:59:06 am »
Quote
And what's in FileListBox1.FileType? Perhaps in the specified directory there are simply no files with the appropriate attribute

Aserge : these are the files of filestreams; with  no specific extension  added to the filename
             i did an extra test to add .txt but that made no difference

Quote
FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS\'; //dont forget the slash at end
FileListBox1.mask:= '*.*'; //file tipe all but *.txt* ,*.csv* can be used

almir, indeed i did forget the'\'at the end ; but adding that made no difference
                     also adding    FileListBox1.mask:= '*.*';    made no difference

i looked around if i had to specifically mark filestream-files  but i couldn,t find that

i have added :
Code: Pascal  [Select][+][-]
  1. if FileListBox1.Items.Count = 0 then  showmessage(' FileListBox1 not filled')
and gave the indication that the items.count=0 ; there are more than 100

frederic
« Last Edit: August 17, 2017, 10:07:09 am by frederic »

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #4 on: August 17, 2017, 11:58:08 am »
Can you see the files in Explorer?
What is the attribute of the file (open a console, cd to the directory, then type attrib)?
By default hidden files are not shown in TFileListBox (not sure about ReadOnly).
IIRC there is some property that controls this (I have no Lazarus right here, so I cannot check).

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #5 on: August 17, 2017, 12:22:48 pm »
If the files have attribute "Normal" you need to include ftNormal in FileType, otherwise the files will not be shown.
(This is because of Delphi compatibility, see revision 54028)

Bart

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #6 on: August 17, 2017, 01:44:31 pm »
bart,
i did what you asked,
the file i mentioned are on the attrib  list (see attachment)

I do not see   an attribute "normal"

ps.  in the first thread i used as directory i  used  FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS';
       it must be FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILETESTFOLDERS'; which is used in the code

frederic
« Last Edit: August 17, 2017, 02:21:26 pm by frederic »

ASerge

  • Hero Member
  • *****
  • Posts: 2242
Re: using filelistbox under win32
« Reply #7 on: August 17, 2017, 03:12:49 pm »
ps.  in the first thread i used as directory i  used  FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS';
       it must be FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILETESTFOLDERS'; which is used in the code
Problem solved?

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #8 on: August 17, 2017, 03:21:25 pm »
 unfortunately not

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: using filelistbox under win32
« Reply #9 on: August 17, 2017, 04:11:08 pm »
bart,
i did what you asked,
the file i mentioned are on the attrib  list (see attachment)

I do not see   an attribute "normal"

ps.  in the first thread i used as directory i  used  FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILEFOLDERS';
       it must be FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILETESTFOLDERS'; which is used in the code

frederic
Normal is not an attribute it means files in general from your screenshot I see that the Archive flag is set how about enabling the ftarchive flag (and ftreadonly since you are there) of the filetype property too?
Quote
>attrib /?
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I]
       [drive:][path][filename] [/S [/D] [/L]]

  +   Sets an attribute.
  -   Clears an attribute.
  R   Read-only file attribute.
  A   Archive file attribute.
  S   System file attribute.
  H   Hidden file attribute.
  I   Not content indexed file attribute.
  [drive:][path][filename]
      Specifies a file or files for attrib to process.
  /S  Processes matching files in the current folder
      and all subfolders.
  /D  Processes folders as well.
  /L  Work on the attributes of the Symbolic Link versus
      the target of the Symbolic Link
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #10 on: August 17, 2017, 04:56:13 pm »
taaz ,
 i have no experience with MSDOS and its attrib statements
so risking to ask you a very stupid question :
i see an A: meaning archiveflag is set
                you asked to set the FTarchiveflag  (What is that on the list and how do you do that?)
same for R   

ps i am on ms VISTA on this pc
frederic
« Last Edit: August 17, 2017, 04:58:11 pm by frederic »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: using filelistbox under win32
« Reply #11 on: August 17, 2017, 05:01:18 pm »
taaz ,
 i have no experience with MSDOS and it attrib statements
so risking to ask you a very stupid question :
i see an A: meaning archiveflag is set
                you asked to set the FTarchiveflag  (What is that on the list and how do you do that?)
same for R   

ps i am on ms VISTA
frederic
No, I asked you to set the ftArchive flag on the filetype property of the filelistbox. see attachment.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

ASerge

  • Hero Member
  • *****
  • Posts: 2242
Re: using filelistbox under win32
« Reply #12 on: August 17, 2017, 05:06:51 pm »
unfortunately not
@frederic, I suspect we are looking for what might be the problem on your machine, because for example I can not reproduce the problem at home. Made the same directory as you, all options by default, no *. * and slash at the end directory name, create files with similar name and archive attribute. I tried to change the attributes of the directory itself (hidden, system, read only) - anyway the files are displayed in FileListBox!

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #13 on: August 17, 2017, 05:38:47 pm »
taaz,

  FileListBox1.filetype ftarchive:=true
FileListBox1.filetype ftREADonly:=true

not succesfull


Almir.Bispo

  • Jr. Member
  • **
  • Posts: 91
  • CSV Comp DB is the Best NoSQL
    • CSV Comp DB (NoSQL)
Re: using filelistbox under win32
« Reply #14 on: August 17, 2017, 06:47:30 pm »
Set Hidden as true,maybe the file are hidden.
CSV Comp DB Developer {Pascal Lover}

 

TinyPortal © 2005-2018