wish to scroll the contents of a listbox and see the selected item at the TOP of the list but no matter what I do
it appears at the bottom

Posted on 2004-07-28 21:13:04 by natalic
There is a problem here:
invoke SendMessage,hList1,LB_SETCURSEL,eax,0
invoke SendMessage,hList1,LB_SETTOPINDEX,eax,0

change it to:
PUSH EAX
invoke SendMessage,hList1,LB_SETCURSEL,eax,0
POP EAX
invoke SendMessage,hList1,LB_SETTOPINDEX,eax,0

Regards,
Antonis
Posted on 2004-07-29 03:36:27 by akyprian
thank you very much akyprian

apologize for my n00b behaviour :D
it's improved indeed: now I see the item at top of the list BUT the very next item is the one selected!
I noticed with debugger that the LB_SELCHANGE message is processed after the WM_VKEYTOITEM
I tried to set the return code from the WM_VKEYTOITEM as suggested in the MSN online docs
but either -2 or -1 doesn't change a thing...

stucked n00b
Posted on 2004-07-29 05:37:43 by natalic
well, it seems that i've found a way to have the listbox doing the thing.
surely my n00b style could be better but i know for sure it'll take time.
for now i can only say i DO love assembler :alright:



:
:
:
[B].ELSEIF uMsg == WM_COMMAND[/B] ; CMD MSGS
mov edx,wParam
movzx eax,dx
shr edx,16

.if edx == LBN_SELCHANGE ; CLICK LISTBOX

mov eax, lParam ; listbox handle
invoke SendMessage, eax, ; get selected item index
LB_GETCURSEL, 0, 0
.if trapkey == 1
mov trapkey, 0
invoke SendMessage,hList1,
LB_SETTOPINDEX,eax,0
.endif
:
:
[B].ELSEIF uMsg == WM_VKEYTOITEM[/B]
mov trapkey, 1
mov eax, wParam
and eax, 0FFh
.if eax > 30h && eax < 35h
.if al == buff1 ; same section
return -1 ; means next item at top row
.endif
.endif
return -2 ; let LBN_SELCHANGE code do the job
:
:
:
:alright: :alright:
Posted on 2004-07-29 16:19:59 by natalic