Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Directory Listing as a Child Window
#1
Hi G,

I have started working on a Proxy FTP Client using QM. Can I get a dir/file listing (similar to OpenSaveDialog) into a treeview control of my window ??
#2
Easily - not. Enumerate files and add tree view items. When expanding a folder, do it again.

Enumerating example - macro "Ftp help".
#3
Seems like I'll have to put my head into it....Thx G
#4
Can start from this.

Function FtpDirDlg
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("FtpDirDlg" &FtpDirDlg)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 202 "Dialog"
;1 Button 0x54030001 0x4 120 186 48 14 "OK"
;2 Button 0x54030000 0x4 172 186 48 14 "Cancel"
;3 SysTreeView32 0x54000000 0x200 0 0 224 182 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020006 "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,mac "FD_Thread" "" id(3 hDlg)
,case WM_DESTROY
,shutdown -6 0 "FD_Thread"
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Function FD_Thread
Code:
Copy      Help
;\FtpDirDlg
function htv

type FTPDIRDATA Ftp'ftp htv ifoldericon
FTPDIRDATA f

f.ftp.Connect("ftp.arm.linux.org.uk" "anonymous" "anonymous")
f.htv=htv

;use system image list; get folder icon index
SHFILEINFO fi
int il=SHGetFileInfo(0 FILE_ATTRIBUTE_DIRECTORY &fi sizeof(fi) SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_SMALLICON)
f.ifoldericon=fi.iIcon
SendMessage(htv TVM_SETIMAGELIST 0 il)

FD_Folder f 0 "pub"

Function FD_Folder
Code:
Copy      Help
;/FtpDirDlg
function FTPDIRDATA&f hparent [$ftpdir]

if(len(ftpdir) and !f.ftp.DirSet(ftpdir)) ret

ARRAY(str) a
int i j
lpstr se

WIN32_FIND_DATA fd
lpstr s=f.ftp.Dir("*" 2 &fd)
rep
,if(s=0) break
,
,if !strcmp(s ".")
,else if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) TvAdd f.htv hparent s 0 f.ifoldericon
,else a[a.redim(-1)]=s
,
,s=f.ftp.Dir("" 2 &fd)

for i 0 a.len
,;out s
,s=a[i]
,
,;get icon index from file extension
,j=findcr(s '.'); if(j>=0) se=s+j; else se=0
,SHFILEINFO fi
,SHGetFileInfo(se 0 &fi sizeof(fi) SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_SMALLICON)
,
,TvAdd f.htv hparent s 0 fi.iIcon
#5
Trying to figure out a dialog to navigate files on an ftp server.

This example works well to enumerate all of the directories and files.

So how would you get it to expand the contents of a folder?

I don't need a fancy tree view, just a linear navigation with an directory control.

When I get to a file, I'd like to be able to double click to get that to download to one directory or shift-double click to download it to a second directory. If getting the clicks to work, a right click menu will be fine. The first directory will be for "Edit File" and the second will be for "Read-Only / View File"

When the file is finished downloading...then it will run with a text editor (Notepad++ or something so I can get some language markup) Is there any sort of way to have an editor in a QM dialog that can markup text according to syntax in a programming language?

I think I'll use something like CFileChangeMonitor to monitor for when I save the changes in the text editor to upload the modified.

It would be nice if all this could be packaged into one dialog where I could use a web browser control to view the live changes I make. This would speed up a lot of things.

Ok, I'm throwing too much out there. Thanks for any help.
Jimmy Vig
#6
Quote:Ok, I'm throwing too much out there.
Yes.
Why don't use an existing FTP program?
#7
I've only tried a few ftp programs...they just always fall short.

Notepad++ has an ftp connection, I just missed it.

Geeze.


Forum Jump:


Users browsing this thread: 1 Guest(s)