Results 1 to 12 of 12

Thread: How do I do that?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    I need to add to my app a ListView that will navigate
    through the user's files.
    By clicking on the file or folder icon, the
    file/folder will be in focus, and I will be able to
    open them, extract them and such...
    Dekel C.

  2. #2
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Wink Have you tried...

    the 'FileListBox' control (Which can be used in conjunction with the 'DirListBox' and 'DriveListBox'.

    Better still, why not use the MS 'CommonDialog' control as this does the whole job for you.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    I have suggested that, but my boss wants it to be with a
    listbox to make it look better.
    Dekel C.

  4. #4
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Question Ermm...

    What is it exactly you want to know then? How to populate a list view control? How to find out directory contents?

    It's not clear what it is exactly you want to do.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    I'll explain:
    I need the list view will show a list of files and folders
    in a drive. Then by dblClicking on a folder, the listview box will go to content of the folder. By clicking on a
    folder or file, the file/folder will be in focus and will
    be able to change the file or folder.
    For etc, WinZip's listview shows zipped files and folders.
    Then, if you click on a file and click "Extarct" it does
    something to the file (Unzip it). right?
    Dekel C.

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    'in declarations
    private path as string
    
    'to populate a listview with directories and files...
        Dim a As String
        a = Dir(path, vbHidden Or vbDirectory)
        Do While Len(a)
            If GetAttr(a) And vbDirectory Then
                ListView1.ListItems.Add a & ", Directory"
            Else
                ListView1.ListItems.Add a & ", File"
            End If
            a = Dir
        Loop
    Now here's something to start with
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Try downloading the COMcache Xplorer Control Set from ComponentSource.
    It includes three FREE controls where one is the CCXploreListView which mimic the right hand pane of Windows Explorer.
    You might have to register at ComponentSource before you're allowed this download, but the registration is free as well.

    Best regards

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    Thanks Joacim!
    But tell me, how do I make the listview control
    in it to go to a certain folder and show it's content?

    [Edited by dekelc on 09-27-2000 at 02:24 AM]
    Dekel C.

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    There are three importent properties here. They are:[*] CurrentFolder[*] CurrentNameSpace[*] CurrentType

    You set the CurrentFolder to any path that you want to see in the listview.
    If you want to see a NameSpace folder such as the Control Panel or the Recycle Bin you set the CurrentNameSpace property to the correct name space.
    The CurrentType determents if you should use the CurrentFolder or the CurrentNameSpace. Just set it to one of these values:[*] 0 - ccFolder[*] 1 - ccNameSpace

    Good luck!

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    What is "correct name space"?
    Dekel C.

  11. #11
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Originally posted by dekelc
    What is "correct name space"?
    ??????????????? Que ????????????????????
    What do you mean by "correct name space". The properties was CurrentNameSpace, CurrentFolder, and CurrentType.

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Yeah, whats namespace??

    Code:
    'in declarations
    private path as string
    
    'to populate a listview with directories and files...
    Sub RefreshList()
        Dim a As String
        listview1.listitems.clear
        a = Dir(path, vbHidden Or vbDirectory)
        Do While Len(a)
            If GetAttr(a) And vbDirectory Then
                ListView1.ListItems.Add a
            Else
                ListView1.ListItems.Add a
            End If
            a = Dir
        Loop
    End sub
    Now if you just changed this a bit so that you don't have the ", directory" and stuff shown then you could just test the path and then repopulate the list with files and subdirs from the new path.
    Code:
    Private Sub ListView1_ItemClick(ByVal Item As ComctlLib.ListItem)
        If GetAttr(Path & "\" & Item.Text) And vbDirectory Then
            Path = Path & "\" & Item.Text 'It's a folder, go into it
        Else
            'It's a file, do somthing else?
        End If
    End Sub

    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width