List Control file path
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: List Control file path

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    21

    List Control file path

    How do I get the path for a seleced item in a list control?

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,205

    Re: List Control file path

    Items in list controls don't have paths. What are you asking?

  3. #3
    Join Date
    Nov 2012
    Posts
    21

    Re: List Control file path

    Im programming a ftp client and im loading files from my computer into a list control. I want to upload files selected in the list control.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,205

    Re: List Control file path

    Your terminology is a bit wonky, which is making it hard to answer your question. You don't upload files into a list control, you upload them to a atorage device. Best guess given what you're asking is to use SetItemData and GetItemData and store the path when you add the file name to the list.

  5. #5
    Join Date
    Nov 2012
    Posts
    21

    Re: List Control file path

    Ok i got a picture in the attachments for understanding..

    I put a red box into the list control that gets the files of the server with FTPFINDFIRSTFILE AND FTPFINDNEXTFILE


    the blue box list control is the file i want to upload..either single of multiple selections


    hopefully this helps
    Attached Images Attached Images  

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,441

    Re: List Control file path

    Quote Originally Posted by terryeverlast View Post
    Ok i got a picture in the attachments for understanding..

    I put a red box into the list control that gets the files of the server with FTPFINDFIRSTFILE AND FTPFINDNEXTFILE


    the blue box list control is the file i want to upload..either single of multiple selections


    hopefully this helps
    GCDEF understands what you are trying to do, but you aren't understanding his reply. What many folks try to do is stick all the data into a control and then read the data out of the control. Like they may want to populate a list control with different data in multiple columns and then when they need to access the data, they read the data out of the column(s) for the selected item.

    While this approach works (kind of) it is very limited because you can only read data that is displayed (not to mention it is awfully slow when dealing with large datasets).

    Another approach is to use the approach that GCDEF suggested which uses SetItemData/GetItemData (or SetItemDataPtr). What this does is tie the control item to a pointer of an underlying object in memory. For example, consider a list of items stored in a collection in memory and a list control is populated using the list. You can associate each item in the control to the underlying list item with SetItemDataPtr. When a user selects a list item in the control, the item in the collection can be access by using the GetItemDataPtr. So now you have access to an item's data (without have to display that data in the control).

    Hopefully that makes more sense.

    If we take this idea one step further, you can set the control up for 'virtual' operation, where the control 'asks' for the data from an underlying collection as the user scrolls up and down on the control. The control only temporarily populates the visible area of the control (plus maybe a bit more). This results in really fast scrolling and a very responsive ui - plus it can handle large data sets.

    For a code sample of this virtual list, see the LVSelState.zip example here:
    http://forums.codeguru.com/showthrea...essage()/page2

    You'll need to modify your collection to contain a hierarchy for your needs but the general idea is the same.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center