Recent

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

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #15 on: August 17, 2017, 07:05:27 pm »
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?

Actually Windows does have a faNomal fileattribute.

Also note that the behaviour of FileType is not exactly the same as Attribute in FindFirst/FindNext.
Only the Greek know why.

Bart
« Last Edit: August 17, 2017, 07:12:54 pm by Bart »

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #16 on: August 17, 2017, 08:22:54 pm »
Quote
et Hidden as true,maybe the file are hidden.

tried,not succesfull

i will try tommorrow on another pc,windows10, and see if we can find differences

frederic

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: using filelistbox under win32
« Reply #17 on: August 17, 2017, 08:33:10 pm »
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?

Actually Windows does have a faNomal fileattribute.

Also note that the behaviour of FileType is not exactly the same as Attribute in FindFirst/FindNext.
Quote
FILE_ATTRIBUTE_NORMAL128 (0x80)                                                                  A file that does not have other attributes set. This attribute is valid only when used alone.
So its a findfile attribute not a file attribute per see.
Only the Greek know why.

Bart
is that along the lines of "it sounds greek to me"? Or should I search for a greek?
« Last Edit: August 17, 2017, 08:34:46 pm by taazz »
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

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #18 on: August 17, 2017, 11:13:38 pm »
Only the Greek know why.
is that along the lines of "it sounds greek to me"? Or should I search for a greek?

The Greek, as in Delphi  O:-)

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #19 on: August 17, 2017, 11:19:33 pm »
Thing you can try:

Set a breakpoint in your OnClick handler, and then step though the code.
Observe what happens inside procedure TCustomFileListBox.UpdateFileList (unit filectrl).
Since that pocedure has changed since 1.6.4,please also test your progam with 1.8C4 or trunk.

Test if FindFirstUtf8/FindNextUtf8 actually finds these files.

Bart

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #20 on: August 19, 2017, 03:55:22 pm »
bart
i made some copys of the data used in the several steps

findwide
out_RST_in Findfirst wide
procinput findwide ansi
findmatch

i see that that there is no match made but cannot find reason for it
may be with these copies you may have or get  a clue
frederic
« Last Edit: August 19, 2017, 03:58:23 pm by frederic »

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #21 on: August 19, 2017, 04:14:07 pm »
Can you post the output of the following test program?

Code: Pascal  [Select][+][-]
  1. program test;
  2.  
  3. {$mode objfpc}
  4. {$ifdef windows}{$apptype console}{$endif}
  5. uses
  6.   sysutils;
  7.  
  8.  
  9. function FileAttrToStr(Attr: LongInt): String;
  10. begin
  11.   if (Attr = -1) then Exit('Invalid');
  12.   Result := '[DASRHVL]';
  13.   if (faDirectory and Attr) = 0 then Result[2] := '-';
  14.   if (faArchive and Attr) = 0 then Result[3] := '-';
  15.   if (faSysFile and Attr) = 0 then Result[4] := '-';
  16.   if (faReadOnly and Attr) = 0 then Result[5] := '-';
  17.   if (faHidden and Attr) = 0 then Result[6] := '-';
  18.   if (faVolumeId and Attr) = 0 then Result[7] := '-';
  19.   if (faSymLink and Attr) = 0 then Result[8] := '-';
  20. end;
  21.  
  22. procedure ListMyFiles;
  23. const
  24.   //Path = '/home/bart/LazarusProjecten/ConsoleProjecten/*';
  25.   Path = 'c:\users\public\STEPBYSTEPFILETESTFOLDERS\*';  //make sure this path is correct !!!
  26. var
  27.   SR: TSearchRec;
  28.   Res: LongInt;
  29.   Count: Integer;
  30. begin
  31.   Count := 0;
  32.   Res := FindFirst(Path, faAnyFile, SR);
  33.   while (Res = 0) do
  34.   begin
  35.     if ((SR.Attr and faDirectory) = 0) then
  36.     begin
  37.       Inc(Count);
  38.       writeln(format('%.2d: %s %s',[Count,FileAttrToStr(SR.Attr),SR.Name]));
  39.     end;
  40.     Res := FindNext(SR);
  41.   end;
  42.   FindClose(SR);
  43. end;
  44.  
  45. begin
  46.   ListMyFiles;
  47. end.
  48.  

Bart

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #22 on: August 19, 2017, 05:29:06 pm »
bart 

i did run the program
saw the console screen for a moment but that dissappaered  immidiately again
was not able to prevent this

ps
Code: Pascal  [Select][+][-]
  1. Path = 'c:\users\public\STEPBYSTEPFILETESTFOLDERS\*';  //make sure this path is correct !!!


the path is correct although i did not use the asterix

ps further  i am away from my pc till somewhere tomorrow
frederic

Thaddy

  • Hero Member
  • *****
  • Posts: 14136
  • Probably until I exterminate Putin.
Re: using filelistbox under win32
« Reply #23 on: August 19, 2017, 05:30:48 pm »
The path needs the asterix.. then it includes all subdirs too.
Specialize a type, not a var.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: using filelistbox under win32
« Reply #24 on: August 19, 2017, 05:33:43 pm »
i did run the program
saw the console screen for a moment but that dissappaered  immidiately again
was not able to prevent this
It is a console program.

Either run it from the console (which also allows you to redirect output) or use a "readln;" directly after the call to "ListMyFiles;" in the main program entry.

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #25 on: August 19, 2017, 11:04:04 pm »
The path needs the asterix.. then it includes all subdirs too.

No, it (FF/FN) definitively does NOT include all subdirectories.
Where did you get that idea from?

@frederic: It needs the '*' on the end, because that tells FF/FN to search for filenames that match that mask: zero or more characters (so, in fact all files).
To what value did you set the Mask property of your FileListBox?

Bart

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #26 on: August 20, 2017, 12:18:02 pm »
test program succesfull!
      result    : attmnt  testprogramxxoutput1
When i i looked at it, i couldn't find the attrib settings back

   these were : attmnt  testprogramxxoutput2


to activate the file box this was done in an onclick event:

 
Code: Pascal  [Select][+][-]
  1. FileListBox1.directory:= 'c:\users\public\STEPBYSTEPFILETESTFOLDERS\';
  2.   if FileListBox1.Items.Count = 0 then  showmessage(' FileListBox1 not filled');

you see also the mask setting in output2 which did not change



frederic

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #27 on: August 20, 2017, 09:26:33 pm »
Well, Findfirst/Findnext do find the files.
I don't know why they do not show up in the filelistbox.

If you (in the onclick of the button) set FileListBox1.Path := 'C:\Windows', do you see any file in the filelistbox?

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5263
    • Bart en Mariska's Webstek
Re: using filelistbox under win32
« Reply #28 on: August 20, 2017, 10:02:07 pm »
I attached a test suite for TFileListBox.
Please build and run.
Select the correct folder if necessary.

You can change the FileType at runtime using the checkboxes.

Does it list any files with
- only ftNomal checked
- only ftArchive checked

Bart

frederic

  • Full Member
  • ***
  • Posts: 226
Re: using filelistbox under win32
« Reply #29 on: August 21, 2017, 10:27:33 am »
bart

Quote
If you (in the onclick of the button) set FileListBox1.Path := 'C:\Windows', do you see any file in the filelistbox?


got the error that this    FileListBox1.Path := 'C:\Windows';   "  identifier idents no member :path"

when  only ftnormal checked :    there are files
when  only ftarchive checked :    there are files

i played  around with the checkboxes and it appeared that  there are always files displayed except when none of the checkboxes is checked.

frederic

 

TinyPortal © 2005-2018