Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #1190 > unrolled thread
| Started by | marc3l0 <mmarloch@gmail.com> |
|---|---|
| First post | 2011-05-25 13:52 -0700 |
| Last post | 2011-05-27 14:35 -0700 |
| Articles | 8 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Help needed with ListBox:ListFiles() marc3l0 <mmarloch@gmail.com> - 2011-05-25 13:52 -0700
Re: Help needed with ListBox:ListFiles() Karl Faller <k.faller_withoutthat_@onlinehome.de> - 2011-05-25 23:39 +0200
Re: Help needed with ListBox:ListFiles() marc3l0 <mmarloch@gmail.com> - 2011-05-25 14:50 -0700
Re: Help needed with ListBox:ListFiles() "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-05-26 00:18 +0000
Re: Help needed with ListBox:ListFiles() marc3l0 <mmarloch@gmail.com> - 2011-05-26 09:43 -0700
Re: Help needed with ListBox:ListFiles() "Karl-Heinz" <invalid@invalid.invalid> - 2011-05-26 21:45 +0200
Re: Help needed with ListBox:ListFiles() "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-05-26 22:09 +0000
Re: Help needed with ListBox:ListFiles() marc3l0 <mmarloch@gmail.com> - 2011-05-27 14:35 -0700
| From | marc3l0 <mmarloch@gmail.com> |
|---|---|
| Date | 2011-05-25 13:52 -0700 |
| Subject | Help needed with ListBox:ListFiles() |
| Message-ID | <8ce28643-8da4-4ada-8d3c-bd61c6ed8cbd@a26g2000vbo.googlegroups.com> |
Hi guys, I'm trying to use the listbox:listfiles() but I get no
results... the method returns true but no file is displayed
the code I tryied was this:
oDCmArquivos:ListFiles('c:\test\',,DDL_ARCHIVE) it returns TRUE but
nothing is show
I tryied this too
oDCmArquivos:ListFiles('c:\test\*.*',,DDL_ARCHIVE)
I also tryied with just the first parameter but no result as well
I didn't realise what the oFixedText parameter means so the issue
could be it
Any help is welcome, thanks a lot
------------------------------------------------------------------------------------------------
here is what the help says
ListBox{[<sStartDir>], [<oFixedText>], [<k FileType>]} ---> lResult
Init([<sStartDir>], [<oFixedText>], [<k FileType>]) ---> lResult
Arguments
<sStartDir> The path or file name of the starting directory.
<oFixedText> Set automatically to the fixed text of the drive/
directory of <sStartDir>.
<k FileType> One of the following constants indicating the attributes
of the files to be displayed:
Windows API Constant Description
DDL_ARCHIVE Includes archived files.
DDL_DIRECTORY Includes subdirectories, enclosed in square brackets
([ ]).
DDL_DRIVES Includes drives, listed in the form [-x-] where x is the
drive letter.
DDL_EXCLUSIVE Includes only files with the specified attributes.
Note: Read-write files are included by default even if DDL_READWRITE
is not specified.
DDL_HIDDEN Includes hidden files.
DDL_READONLY Includes read-only files.
DDL_READWRITE Includes read-write files with no additional attributes
specified.
DDL_SYSTEM Includes system files.
DDL_POSTMSGS Posts messages to the application’s message queue.
Returns
TRUE if successful; otherwise, FALSE.
[toc] | [next] | [standalone]
| From | Karl Faller <k.faller_withoutthat_@onlinehome.de> |
|---|---|
| Date | 2011-05-25 23:39 +0200 |
| Message-ID | <7dtqt6p614rvt20qepcdh3kttu92b386d3@4ax.com> |
| In reply to | #1190 |
Marc,
made BasicDlg sample, added:
METHOD PostInit(oParent, uExtra) CLASS MainDialog
SELF:oDClb1:ListFiles("C:\*.txt")
shows content of my C drive's txt files, plus folders, and, somewhat
strangely, also all of my drives
SELF:oDClb1:ListFiles("C:\*.txt",,DDL_EXCLUSIVE)
interestingly shows nothing
SELF:oDClb1:ListFiles("C:\*.txt",,DDL_SYSTEM )
shows ONLY the txt file
HTH
Karl
On Wed, 25 May 2011 13:52:39 -0700 (PDT), marc3l0 <mmarloch@gmail.com>
wrote:
>Hi guys, I'm trying to use the listbox:listfiles() but I get no
>results... the method returns true but no file is displayed
>
>the code I tryied was this:
>
>oDCmArquivos:ListFiles('c:\test\',,DDL_ARCHIVE) it returns TRUE but
>nothing is show
>
>I tryied this too
>
>oDCmArquivos:ListFiles('c:\test\*.*',,DDL_ARCHIVE)
>
>I also tryied with just the first parameter but no result as well
>
>I didn't realise what the oFixedText parameter means so the issue
>could be it
>
>Any help is welcome, thanks a lot
>
>------------------------------------------------------------------------------------------------
>here is what the help says
>
>ListBox{[<sStartDir>], [<oFixedText>], [<k FileType>]} ---> lResult
>
>Init([<sStartDir>], [<oFixedText>], [<k FileType>]) ---> lResult
>
>Arguments
>
><sStartDir> The path or file name of the starting directory.
><oFixedText> Set automatically to the fixed text of the drive/
>directory of <sStartDir>.
><k FileType> One of the following constants indicating the attributes
>of the files to be displayed:
>
>Windows API Constant Description
>DDL_ARCHIVE Includes archived files.
>DDL_DIRECTORY Includes subdirectories, enclosed in square brackets
>([ ]).
>DDL_DRIVES Includes drives, listed in the form [-x-] where x is the
>drive letter.
>DDL_EXCLUSIVE Includes only files with the specified attributes.
>Note: Read-write files are included by default even if DDL_READWRITE
>is not specified.
>DDL_HIDDEN Includes hidden files.
>DDL_READONLY Includes read-only files.
>DDL_READWRITE Includes read-write files with no additional attributes
>specified.
>DDL_SYSTEM Includes system files.
>DDL_POSTMSGS Posts messages to the application’s message queue.
>Returns
>
>TRUE if successful; otherwise, FALSE.
[toc] | [prev] | [next] | [standalone]
| From | marc3l0 <mmarloch@gmail.com> |
|---|---|
| Date | 2011-05-25 14:50 -0700 |
| Message-ID | <464b6859-e0ee-46e4-a59d-14ce4047cb93@l6g2000vbn.googlegroups.com> |
| In reply to | #1190 |
Hi all, Thanks Karl for your prompt help but i found the ****** issue after some head hits on my desk and looking out the windows API I found the issue... the listbox control MUST BE ON A DIALOG WINDOW!!! this way the listbox:listfiles() works perfect... now the question is why this information is not in the help file... anyway if anyone get the same problem the solution is that thanks everyone
[toc] | [prev] | [next] | [standalone]
| From | "Geoff Schaller" <geoffx@softwarexobjectives.com.au> |
|---|---|
| Date | 2011-05-26 00:18 +0000 |
| Message-ID | <4ddd9c67$0$67776$c30e37c6@exi-reader.telstra.net> |
| In reply to | #1193 |
No. It works equally on dialogs and datawindows. This can have nothing to do with anything. Geoff "marc3l0" <mmarloch@gmail.com> wrote in message news:464b6859-e0ee-46e4-a59d-14ce4047cb93@l6g2000vbn.googlegroups.com: > Hi all, Thanks Karl for your prompt help but i found the ****** issue > > after some head hits on my desk and looking out the windows API I > found the issue... the listbox control MUST BE ON A DIALOG WINDOW!!! > > this way the listbox:listfiles() works perfect... > > now the question is why this information is not in the help file... > > anyway if anyone get the same problem the solution is that > > thanks everyone
[toc] | [prev] | [next] | [standalone]
| From | marc3l0 <mmarloch@gmail.com> |
|---|---|
| Date | 2011-05-26 09:43 -0700 |
| Message-ID | <3dbfe8b2-1981-4ed4-a7f7-0a2db69a38d4@f11g2000vbx.googlegroups.com> |
| In reply to | #1190 |
well i'm using VO 2.6 and it did not work in datawindows. I did not
change anything in my code just put it on a dialogwindow and the issue
was solved... maybe it is a bug though... but look at the first
parameter of the windows API function
here is the API call that I THINK VO uses internaly...(NOTE THE FIRST
PARAMETER SAYS HANDLE TO DIALOG BOX)
The DlgDirList function fills the specified list box with the names of
all files matching the specified path or filename.
int DlgDirList(
HWND hDlg, // handle to dialog box with list box
LPTSTR lpPathSpec, // pointer to path or filename string
int nIDListBox, // identifier of list box
int nIDStaticPath, // identifier of static control
UINT uFileType // file attributes to display
);
Parameters
hDlg
Identifies the dialog box that contains the list box.
lpPathSpec
Points to a null-terminated string that contains the path or filename.
DlgDirList modifies this string, which should be long enough to
contain the modifications. For more information about this parameter,
see the Remarks section.
nIDListBox
Specifies the identifier of a list box. If this parameter is zero,
DlgDirList assumes that no list box exists and does not attempt to
fill one.
nIDStaticPath
Specifies the identifier of the static control used for displaying the
current drive and directory. If this parameter is zero, DlgDirList
assumes that no such control is present.
uFileType
Specifies attributes of the filenames to be displayed. This parameter
must be one or more of the following values:
Value Description
DDL_ARCHIVE Includes archived files.
DDL_DIRECTORY Includes subdirectories. Subdirectory names are enclosed
in square brackets ([ ]).
DDL_DRIVES Includes drives. Drives are listed in the form [-x-], where
x is the drive letter.
DDL_EXCLUSIVE Includes only files with the specified attributes. By
default, read-write files are listed even if DDL_READWRITE is not
specified.
DDL_HIDDEN Includes hidden files.
DDL_READONLY Includes read-only files.
DDL_READWRITE Includes read-write files with no additional attributes.
DDL_SYSTEM Includes system files.
DDL_POSTMSGS Posts messages to the application’s message queue. By
default, DlgDirList sends messages directly to the dialog box
procedure.
thanks everyone
[toc] | [prev] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2011-05-26 21:45 +0200 |
| Message-ID | <947p0sFv6dU1@mid.individual.net> |
| In reply to | #1204 |
marc310
> well i'm using VO 2.6 and it did not work in datawindows. I did not
> change anything in my code just put it on a dialogwindow and the issue
> was solved... maybe it is a bug though... but look at the first
> parameter of the windows API function
There´s indeed a problem. When the ListBox is used on a DataWindow it
doens´t work. I´ve added a IF statement to check which handle is required.
Try the new "MyListFiles()" method below. It should now work on DataWindows
and Datadialogs.
NOTE: The sources are based on the 2.8 SDK. Maybe the 2.6 sources are
slightly different. But the important part ist to feed the DlgDirList()-API
call with the correct handle.
.
METHOD MyListFiles(sStartDir, oFixedText, FileTypes) CLASS ListBox
LOCAL pPath AS PSZ
LOCAL i,iRet AS INT
LOCAL dwFileTypes AS DWORD
LOCAL w AS DWORD
Default(@sStartDir, "*.*")
pPath := StringAlloc(sStartDir)
pPath := MemRealloc(pPath, 261)
IF !IsNil(FileTypes)
dwFileTypes := FileTypes
ELSE
dwFileTypes := _OR(DDL_DIRECTORY, DDL_DRIVES)
ENDIF
IF !IsNil(oFixedText)
w := oFixedText:ControlID
ENDIF
// <----------
IF IsInstanceOf ( oParent , #DataWindow )
iRet := DlgDirList(oParent:__GetFormSurface():handle(), pPath,
INT(wID), INT(w), dwFileTypes )
ELSE
//iRet := call(fpListFiles, oParent:Handle(), pPath, wID, w,
dwFileTyp
iRet := DlgDirList(oParent:handle(), pPath, INT(wID), INT(w),
dwFileTypes )
ENDIF
// <--------------
MemFree(pPath)
iRet := SUPER:ItemCount
//RvdH 050602, Bug [12898] Now fill aRetValues and aDisplayValues
arra
aRetValues := ArrayNew(iRet)
aDisplayValues := ArrayNew(iRet)
FOR i := 1 TO iRet
aRetValues[i] := SELF:GetItem(i)
aDisplayValues[i] := aRetValues[i]
NEXT
RETURN (iRet != 0)
regards
Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | "Geoff Schaller" <geoffx@softwarexobjectives.com.au> |
|---|---|
| Date | 2011-05-26 22:09 +0000 |
| Message-ID | <4ddecfac$0$67777$c30e37c6@exi-reader.telstra.net> |
| In reply to | #1204 |
Quite apart from the fact I am not interested in 2.6 or what 2.6 did, the issue with using API calls directly is to use the CORRECT window to pass as the dialog handle. In the case of the data window it is not the container handle (oDataWin:Handle()) but the oSurface:Handle() - which you shold manually expose in your subclassed data window. I assure you, this mechanism works on data windows in both 2.6 and 2.8 Geoff "marc3l0" <mmarloch@gmail.com> wrote in message news:3dbfe8b2-1981-4ed4-a7f7-0a2db69a38d4@f11g2000vbx.googlegroups.com: > well i'm using VO 2.6 and it did not work in datawindows. I did not > change anything in my code just put it on a dialogwindow and the issue > was solved... maybe it is a bug though... but look at the first > parameter of the windows API function > > here is the API call that I THINK VO uses internaly...(NOTE THE FIRST > PARAMETER SAYS HANDLE TO DIALOG BOX) > > The DlgDirList function fills the specified list box with the names of > all files matching the specified path or filename. > > int DlgDirList( > > HWND hDlg, // handle to dialog box with list box > LPTSTR lpPathSpec, // pointer to path or filename string > int nIDListBox, // identifier of list box > int nIDStaticPath, // identifier of static control > UINT uFileType // file attributes to display > ); > Parameters > > hDlg > > Identifies the dialog box that contains the list box. > > lpPathSpec > > Points to a null-terminated string that contains the path or filename. > DlgDirList modifies this string, which should be long enough to > contain the modifications. For more information about this parameter, > see the Remarks section. > > nIDListBox > > Specifies the identifier of a list box. If this parameter is zero, > DlgDirList assumes that no list box exists and does not attempt to > fill one. > > nIDStaticPath > > Specifies the identifier of the static control used for displaying the > current drive and directory. If this parameter is zero, DlgDirList > assumes that no such control is present. > > uFileType > > Specifies attributes of the filenames to be displayed. This parameter > must be one or more of the following values: > > Value Description > DDL_ARCHIVE Includes archived files. > DDL_DIRECTORY Includes subdirectories. Subdirectory names are enclosed > in square brackets ([ ]). > DDL_DRIVES Includes drives. Drives are listed in the form [-x-], where > x is the drive letter. > DDL_EXCLUSIVE Includes only files with the specified attributes. By > default, read-write files are listed even if DDL_READWRITE is not > specified. > DDL_HIDDEN Includes hidden files. > DDL_READONLY Includes read-only files. > DDL_READWRITE Includes read-write files with no additional attributes. > DDL_SYSTEM Includes system files. > DDL_POSTMSGS Posts messages to the application's message queue. By > default, DlgDirList sends messages directly to the dialog box > procedure. > > > thanks everyone
[toc] | [prev] | [next] | [standalone]
| From | marc3l0 <mmarloch@gmail.com> |
|---|---|
| Date | 2011-05-27 14:35 -0700 |
| Message-ID | <8b084742-4d32-456b-8308-0d53073bb888@e21g2000vbz.googlegroups.com> |
| In reply to | #1190 |
thanks a lot Karl Heinz, you the man!!! it worked as a charm!!! and thanks to you too Geoff, note that i'm not using the API call, i'm using the LISTBOX:listfile() and for sure that do not work on my datawindow... but now with Karl Heinz's code all worked fine... problem solved thanks everyone
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web