News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

list view items and icons

Started by ossama, November 28, 2007, 04:00:03 PM

Previous topic - Next topic

ossama

hello,i have a problem with icons in listview, when i insert an item with an icon , the icon background is black (in the listview), any solution for this problem.

ragdog

hi ossama

here is a small example from my tool!


greets
ragdog

[attachment deleted by admin]

ossama

ragdog,
in the line number 49 , you wrote this:
   mov lvi.imask, LVIF_TEXT or LVIF_IMAGE or LVIR_ICON
i have read in msdn about the member imask of the LVITEM structure, but i did not find LVIR_ICON as a valid constant in the imask member, i have msdn2005,
would you explain to me why did you set the flag LVIR_ICON and where did you get this info (from msdn or somewhee else)
sorry for my bad english

ragdog


hi

LVIR_ICON : Returns the bounding rectangle of the icon or small icon.
you can find by msdn

and you can find the constant in windows.inc
LVIR_ICON       equ 1

greets
ragdog

ossama

ragdog, i mean i saw msdn for the flags that can be set in the imask member of the LVITEM structure, but the LVIR_ICON was not found

ossama

i have found this in msdn:


mask
Set of flags that specify which members of this structure contain data to be set or which members are being requested. This member can have one or more of the following flags set:
LVIF_COLUMNS
The cColumns member is valid or must be filled in.
LVIF_DI_SETITEM
The operating system should store the requested list item information and not ask for it again. This flag is used only with the LVN_GETDISPINFO notification message.
LVIF_GROUPID
The iGroupId member is valid or must be filled in.
LVIF_IMAGE
The iImage member is valid or must be filled in.
LVIF_INDENT
The iIndent member is valid or must be filled in.
LVIF_NORECOMPUTE
The control will not generate LVN_GETDISPINFO to retrieve text information if it receives an LVM_GETITEM message. Instead, the pszText member will contain LPSTR_TEXTCALLBACK.
LVIF_PARAM
The lParam member is valid or must be filled in.
LVIF_STATE
The state member is valid or must be filled in.
LVIF_TEXT
The pszText member is valid or must be filled in.


ossama

thank you ragdog for your help and for your quick reply,

ossama

ragdog,
but how did you use LVIR_ICON (a flag valid for LVM_GETITEMRECT message) in the member imask of LVITEM structure, is it possible?

ossama

hello, i write a simple program to show my problem, it is a main window with toolbar, listview, and a button.
in  the button, the icon is shown very well,
but in the toolbar and listview, the icon is shown with black background,
the problem is why this behavior, what i need is to show the icon without this backround (show icon with transparent backround like the icon in the button)

[attachment deleted by admin]

Shantanu Gadgil

The black background is usually caused because the icon matching the current display depth is not found inside the icon.

So if you are loading a 48x48 icon and running at 32bits, it would try to load th 48x48 true color icon.
(Also, I think if there is a TRUE-COLOR and an ALPHA-BLENDED icon, it would pick the ALPHA-BLENDED one!)

I would suggest you create an "alpha-blended" icon and try to load that.

I think there is some "MASK" value in the ImageList_Create is required! (related to the ILC_COLOR32)

Sorry about being so vague, don't have my code with me right now.

(I have not read any documentation regarding the icon loading thing, most of the findings were by trial and error)

I shall post the detailed code from home, if of course, your problem is not solved by then!!!  :bg  :green

Regards,
Shantanu
To ret is human, to jmp divine!

ossama

thnak you Shantanu Gadgil, but this problem keep in the case of 32*32 icons (i hope i understood you ,cause my bad english)

Shantanu Gadgil

OOhhh. ... I just remembered .... try adding a "XP Manifest" in your project!!!

Regards,
Shantanu
To ret is human, to jmp divine!

ossama

Shantanu Gadgil, i just add an xp manifest to my project without any changes to my project,or i have to use alpha-blended icons?

Shantanu Gadgil

Keep the previous icon as it was ... just add the manifest.
I assume you know what a MANIFEST is, but just in case, save the following code as some file, say "manifest.xml" (obviously, the name can be anything else  :bg)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="CompanyName.ProductName.YourApplication"
    type="win32"
/>
<description>Your application description here.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>


Then in your .RC file add the line:
1 24 "manifest.xml"

Ref: http://msdn2.microsoft.com/en-us/library/ms649781.aspx#extensions

(I remember that the value of RT_MANIFEST is 24, but you can verify that from the windows.inc or the Platform SDK headers)

Regards,
Shantanu
To ret is human, to jmp divine!