Results 1 to 16 of 16

Thread: Edit ListView SubItem

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Edit ListView SubItem

    I found this and it looked yery promising
    https://www.vbforums.com/showthread....t-for-SubItems
    But when I try it unless I don't set view to Report (which he doesn't do but his listview somehow is) I get as below.
    And if I set Report view, nothing shows at all.
    Anyone know more about this (or perhaps have something else that works)?
    Attached Images Attached Images  

  2. #2
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    724

    Re: Edit ListView SubItem

    All these items seems to be in LargeIcon or List Mode since there are no imagelist attached to it.
    If you switch this view to Report view, all items will become "sub items" with index 0. The first leftmost column.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Re: Edit ListView SubItem

    As said, in Report view nothing shows. And while the example in the link works, there's no view set.

  4. #4
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    724

    Re: Edit ListView SubItem

    You must insert column headers in Report View or else nothing will show.

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,552

    Re: Edit ListView SubItem

    Most solutions just manually position a textbox over the subitem when it's time to edit

    The built in subitem controls (including edit and multiline edit) are my white whale. They work fantastic. I've never been able to get them to work in VB though, only C++. Have put in several major efforts of many hours over the years. I've actually been working on it again recently, trying it in twinBASIC, with a few more years of knowledge and experience, and tB's native language definitions to try more things faster without recompiling typelibs externally. Doing a ground up rewrite though so taking a bit. If I get it working there I'll try backporting it to VB6.

    This is what we'll have in regular ListViews if I succeed:



    The one that says 'Center Weight Average' is particularly neat--- that's a property for JPEGs. All you have to do is specify a property key, and it populates a dropdown combobox of all the options (here, for "System.Photo.MeteringMode").
    Last edited by fafalone; Nov 28th, 2023 at 11:08 AM.

  6. #6
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,725

    Re: Edit ListView SubItem

    Have you succeeded?
    Windows system built-in table control. listview
    It would be convenient if there was an easier way to modify and add data, or to edit directly on the control.

  7. #7
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,552

    Re: Edit ListView SubItem

    Have succeeded in C++, not VB6. twinBASIC version isn't quite ready to test; I will report back in a day or two.

    Timo Kunze's C++ version: https://www.codeproject.com/Articles...-View-Features

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Re: Edit ListView SubItem

    @fafalone I do hope you succeed ! nebeln, thanks for tip about Headers. Now I see something but still can't get mine working like the example.
    You must first click the column 1 for that row to become "active".

    But not in his example in msg 1, where there is no code setting up headers or views... only a loop adding 4 columns and 30 rows. And his edit text box fits better.
    Does anyone know how he does that, and if I could use it in my project?
    Also, is it possible to not have any row highlighted or selected when it first opens? I tried setfocus to a text box but that gave an error

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Re: Edit ListView SubItem

    Duh! Apoligies guys, first time I've ever seen data in the Form like this has. Dragged Form2 into Notepad and now getting somewhere.

  10. #10
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    724

    Re: Edit ListView SubItem

    You never mentioned if your ListView is from the Comctl32.ocx or if it's created dynamically via CreateWindowEx API?
    Since the ListView from ComCtl32.ocx is totally different from the more suitable sysListView32 from the ListView class.
    I don't know how your skills and knowledge are about Comctl's in general? Me personal NEVER use the "toolbox" in VB6. Do I need one or more controls I create them from scratch...this approach gives you more control in what you need from the control(s) and also YOU control the controls. This approach I have briefly mentioned demands sertain skills in subclassing and event handling. The example Mr Fafalone showed is a exotic and complex handling of Comctl's within the given Comctl which is the nice thing about having the complete control of the controls as I mentioned earlier.

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Re: Edit ListView SubItem

    This may be a big ask but hoping someone here might be able to point out a difference in the attached.
    I've spend several days and can't work it out. This is not my code but adapting it into my project.
    It allows editing of listview sub items. Its what was discussed in the thread.
    The problem is Form2 does not allow a click to select the first column, but frmEPLP does. And I'd like it not to.
    They both use the same Module and class. Thank you.
    Attached Files Attached Files

  12. #12
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,725

    Re: Edit ListView SubItem

    Windows controls will be out of date sooner or later. Maybe we should look for a new web form control, which can be edited and added.

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Re: Edit ListView SubItem

    @fafalone if you were developing something, how's progress ?

  14. #14
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    724

    Re: Edit ListView SubItem

    Regarding Timo's IID_IListViewFooter {0xF0034DA8, 0x8A22, 0x4151,
    {0x8F, 0x16, 0x2E, 0xBA, 0x76, 0x56, 0x5B, 0xCC}}

    Where did he get that GUID from?
    I got these GUID strings in my sysListView32 bas-module...

    Code:
    Public Const IID_IListViewFooter As String = "{F0034DA8-8A22-4151-8F16-2EBA76565BCC"
    Public Const IID_IListViewFooterCallback As String = "{88EB9442-913B-4AB4-A741-DD99DCB7558B"
    So which of theese are the correct ones?

  15. #15
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,552

    Re: Edit ListView SubItem

    @AlexanderBB didn't get a chance to work on it again before the weekend, then went away for the weekend and just got back. I'll be working on it again in the next couple days.


    @nebeln They're both correct. IListViewFooter and IListViewFooterCallback are different interfaces. Footer items work great in VB6, they even work in the comctllib.ocx ListView.

  16. #16
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    724

    Re: Edit ListView SubItem

    Aha, I see...I know there are two different Interfaces but I just added the IListViewFooterCallback string GUID as a side kick

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