News:

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

Scrolling a listview programmatically

Started by Grincheux, February 15, 2009, 04:41:17 PM

Previous topic - Next topic

Grincheux

Hello !

My proc is analyzing items found in a listview.
I have to replace the text of the first colum by "Running"
The I run a small proc
When it returns I change "Running" by "Stoppped".
Then I get the next item
and the loop goes on

All of this is good and have no problem.

But if the listview can show 20 items on 200, I cannot see the 21st...
I wouldlike to scroll the listview but I did not find how to do it.

Here is my code :


@Loop :

lea edi,_Lvi
lea eax,_szServerName

mov (LVITEM Ptr [edi]).imask,LVIF_PARAM or LVIF_TEXT
mov (LVITEM Ptr [edi]).pszText,eax
mov (LVITEM Ptr [edi]).cchTextMax,SIZEOF _szTmp
mov (LVITEM Ptr [edi]).iItem,ebx
mov (LVITEM Ptr [edi]).iSubItem,0

INVOKE SendMessage,__hListView,LVM_GETITEM,0,edi
INVOKE Language_GetTextEx,26,_lpszTmp,SIZEOF _szTmp

mov (LVITEM Ptr [edi]).imask,LVIF_TEXT
mov (LVITEM Ptr [edi]).iSubItem,1
mov (LVITEM Ptr [edi]).pszText,eax

INVOKE SendMessage,__hListView,LVM_SETITEM,0,edi
INVOKE SendMessage,__hListView,LVM_ENSUREVISIBLE,0,0

mov (LVITEM Ptr [edi]).stateMask,LVIS_FOCUSED or LVIS_SELECTED
mov (LVITEM Ptr [edi]).state,LVIS_FOCUSED or LVIS_SELECTED

INVOKE SendMessage,__hListView,LVM_SETITEMSTATE,ebx,edi

INVOKE Analyse_Scrute,_lpszServerName

mov (LVITEM Ptr [edi]).stateMask,LVIS_FOCUSED or LVIS_SELECTED
mov (LVITEM Ptr [edi]).state,0

INVOKE SendMessage,__hListView,LVM_SETITEMSTATE,ebx,edi

INVOKE Language_GetTextEx,25,_lpszTmp,SIZEOF _szTmp

mov (LVITEM Ptr [edi]).iSubItem,1
mov (LVITEM Ptr [edi]).pszText,eax

INVOKE SendMessage,__hListView,LVM_SETITEM,0,edi

add ebx,1

INVOKE SendMessage,__hListView,LVM_GETITEMCOUNT,0,0

cmp ebx,eax
jle @Loop

xor ebx,ebx
jmp @Loop


Kenavo

Grincheux
_____________________________________________________
http://www.phrio.biz

PBrennick

Grincheux,

ListView_EnsureVisible will do this for you. It will, if necessary, scroll the item into view.

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

Grincheux

Thanks Paul,

I made an error while passing parameters.
I have corrected it and now it works fine.

Bye
Kenavo

Grincheux
_____________________________________________________
http://www.phrio.biz