Thread: ListView in Report mode help

  1. #1
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591

    ListView in Report mode help

    Hi again all,
    I need some help getting my report-mode ListView to look decent (i.e. resemble the filebrowser in explorer). So far I was able to tweak most things the way I needed them except for these two setbacks:
    1) While using the LVS_EX_BORDERSELECT (where the highlighting is placed around the text/icon instead of over it) the selection border displays *larger* than the items themselves resulting in the selection border overlapping the items above and below it. To fix this, I was hoping I could adjust the height of each item (as in a listbox or combobox), but I can't seem to find a way to adjust item height in a report-mode ListView (i.e, something similar to LB_SETITEMHEIGHT, or CB_SETITEMHEIGHT... alas no LVM_SETITEMHEIGHT?)
    I found some discussion on google talking about using an ownerdrawn style instead and catching WM_SETSIZE messages, however that's a bit too advanced for me at the moment... so might there be a message I could send instead or function I could call to achieve this?

    2) Whenever I add an icon to one of the column headers, the background of the icon, which should be transparent, appears white instead. This seems to be something unique with the headers as adding the same icons to other controls (such as buttons or labels) displays them correctly. I'm worried it may have something to do with the icon's masking, bitdepth, resolution, etc, and in that area, I have no idea what the appropriate masking would be in order to show an icon with a transparent background in a header. Does anyone know what kind of icon/image type I should be using for this? also, is there a generic way to implement sortup/down icons on headers?

    Here is a screenshot of the problems I am describing.
    If anyone could help me out with these it'd be greatly appreciated, thanks!

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    IS this application targetting only XP and above?

    If it is, you can solve the LVS_EX_BORDERSELECT problem by enabling common controls version 6.

    Again, if targetting XP, you can solve the icon problem by using header control sort arrows (here is a screenshot of a listview with sort arrows).

  3. #3
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    anonytmouse to the rescue again with links and liferafts! Thanks man, right on the money!
    .. about targetting a specific windows version: if I target XP specifically, will that render my application broken (like critical-stop-run-time-error broken) in all other versions, or will it just disable some of the aesthetics but leave the functionality in tact?
    p.s. do I get frequent flyer miles yet?

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Generally, if you use a function that is not available on the current platform, the program will fail with an error message while loading.

    If you use a constant in a function call and that constant is not available on the current platform, the function is likely to fail silently.

    If you use a version define (such as #define _WIN32_WINNT 0x501) then some of the Win32 code in that source file is likely to fail when run on earlier platforms. This is a little tricky as not all Win32 code will fail (the code that will fail usually involves structures that have changed between versions).

    In regards to the specifics above, enabling common controls version 6 will not cause problems on older platforms, but any feature that relies on version 6 will not work on older platforms.

    The header control sort arrows require version 6, so will silently fail on older platforms. In addition the code requires a version define, so if you use it, you should put it in a seperate source file so that the version define does not break the rest of your code.

    >> p.s. do I get frequent flyer miles yet? <<

    Yep. The only problem is that my frequent flyer points are worth about as much as the real thing: crap, diddly, squat!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 12:57 PM
  2. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  3. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  4. Creating Listview in Report Mode with WinAPI
    By golfinguy4 in forum Windows Programming
    Replies: 1
    Last Post: 06-12-2003, 08:09 PM
  5. listview - report & showselectionalways
    By lobo in forum Windows Programming
    Replies: 3
    Last Post: 07-04-2002, 01:31 AM