News:

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

Listview missing icon on selecting row

Started by fearless, March 05, 2009, 12:30:03 PM

Previous topic - Next topic

fearless

Hi,

Ive recently come across a small problem with a listview control. I create a report style and add a number of items and subitems and icons from an imagelist. All rows display fine, but when i select a row, the icon associated with the row is blanked out/disappears, when i move off from that and select another row the previous icon row is displayed fine and the new row icon that is currently selected disappears.

This problem seems to only occur when adding a manifest for new xp style. Ive searched here and other asm forums in case i have missed something with regard to listviews, manifest adding or posts indicating similar problems for other users. So far im stumped, so just wondering if anyone has come across the problem?

I have a few other projects that re-use my own listview lib of procs, and i have re-used the same icons as resources, to see if there is a prob with the actual .ico files i was previously using. But i cant see any differences except the manifest thing which does work in all my other projects - weird.

I think i will go back to create a simple project with just my listview library code, and a simple listview to test this bad boy out, but if anyone has come across this issue or can suggest what might be the cause, then that would be great.

Cheers.
ƒearless

fearless

Ive attached a simple listview project that shows the problem. Only seems to occur when ive added in the xp style manifest





[attachment deleted by admin]
ƒearless

akane

Hi, you need to add LVIF_IMAGE flag to .mask before adding items, and ofcourse set .iImage to the image index.

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

fearless

I still seem to have the same problem. I went back to insert code in the WM_INITDIALOG section:

; Mask
mov LVItem.imask, LVIF_TEXT or LVIF_STATE or LVIF_IMAGE or LVIF_PARAM

; Item
push 1
pop LVItem.iItem

; Subitem
mov LVItem.iSubItem,0

; Statemask
mov LVItem.stateMask, LVIS_FOCUSED

; pszText
Invoke szCopy, CTEXT("Test Item1"), Addr LVItemText
mov eax, Offset LVItemText
mov LVItem.pszText, eax

; cchTextMax
mov LVItem.cchTextMax, MAX_PATH

; image
mov eax, 0
mov LVItem.iImage, eax

; lParam
push 1
pop LVItem.lParam

; Do it
invoke SendMessage, hListview, LVM_INSERTITEM, 0, Addr LVItem



; Mask
mov LVItem.imask, LVIF_TEXT or LVIF_STATE or LVIF_IMAGE or LVIF_PARAM

; Item
push 2
pop LVItem.iItem

; Subitem
mov LVItem.iSubItem,0

; Statemask
mov LVItem.stateMask, LVIS_FOCUSED

; pszText
Invoke szCopy, CTEXT("Test Item2"), Addr LVItemText
mov eax, Offset LVItemText
mov LVItem.pszText, eax

; cchTextMax
mov LVItem.cchTextMax, MAX_PATH

; image
mov eax, 1
mov LVItem.iImage, eax

; lParam
push 2
pop LVItem.lParam

; Do it
invoke SendMessage, hListview, LVM_INSERTITEM, 0, Addr LVItem


I get both icons loaded, but row selection still causes the row icon to disappear
ƒearless

jj2007

Same problem here.. Have you noticed that the icon reappears before the About box displays?

fearless

Yes i noticed that as well, seems to be a strange problem. If i ditch the xp manifest, all is well again. I just cant figure out what is different with my other projects that work with the listview and xp manifest. Ive tried importing code from my other projects, using the same icons, resources, same properties in dlgs, and resource files, and played around with the code. Actually i just recompiled another project and the same issue is now showing up there as well - and it worked before. Only thing that might have changed since last look/use/compile of older projects (well before nov last year) is xp sp3 and/or the recent .net 3.5 update along with all other recent updates, maybe an update to the components has caused this, i might try and bring the project into work to try on a machine that is less likely to have all ms updates installed to see if it is just my machine or others as well to rule out that possiblity.
ƒearless

PBrennick

fearless,
I rebuilt your code on my machine which does not have .NET installed and I have the same problem. I DO have SP3 installed so your problem is probably there.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

jj2007

Quote from: fearless on March 06, 2009, 12:04:14 AM
If i ditch the xp manifest, all is well again. I just cant figure out what is different...

Assemble the two versions, and ask Olly what is different.

Quote
xp sp3
I have the problem with SP2.

fearless

Ive been searching MS site and seen a few posts relating to EnableVisualStyles and images dissappearing and/or not showing up when using listviews. Im going to uninstall .net 3.5 sp1 and go back and see if that is the culprit. Most of the posts are related to .net but i have a feeling it is related.
ƒearless

jj2007

If you uninstall .net, and it works afterwards, you will never find out who the culprit was. Compare the two versions with a disassembler or OllyDbg, and you will find out which of the invokes is different...