hi all friends :)

just an easy question: i would like a vertical scrollbar always visible in a listview, also if i don't need it couse items are less than the height of the list...

I've discover ShowScrollBar api, i've put it in my notify message, it works but i would like the bar without the cursor, disabled.

THX B7
Posted on 2003-11-27 12:27:54 by Bit7
Hi,

I don't try with listview but, i use below code for viewing big res. BMP files into small dialogs. Scrollbar's always visible. SetScrollRange MaxPos must be bigger than window client area.





call ShowScrollBar,hwnd,SB_BOTH,1
call SetScrollRange,hwnd,SB_VERT,0,1000,1





BOOL SetScrollRange(

HWND hWnd, // handle of window with scroll bar
int nBar, // scroll bar flag
int nMinPos, // minimum scrolling position
int nMaxPos, // maximum scrolling position
BOOL bRedraw // redraw flag
);



Regards,
Posted on 2003-11-28 12:39:54 by CYDONIA
thx, but it don't have the effect i wanted..

Wold like scrollbar visible and disabled if there's no scroll need, auto enabled when scroll is needed, just as the window of this forum i'm typing in now. I'm going to subclassing the listview to get the WM_SCROLL message.
Posted on 2003-11-29 01:40:23 by Bit7
here we go,

the listview is the only control that don't show scrollbars if don't needed :(

i've subclassed the listview, then on WM_SIZE and NOTIFY i added

call SendMessageA, , LVM_GETITEMCOUNT, 0, 0
mov esi, eax
mov , size sci
mov , SIF_PAGE
call GetScrollInfo, , SB_VERT, offset sci
call SendMessageA, , LVM_GETITEMCOUNT, 0, 0
cmp , eax
jl @@dScroll
@@eScroll: call EnableScrollBar, , SB_VERT, ESB_DISABLE_BOTH
call ShowScrollBar, , SB_VERT, TRUE
jmp @@eom
@@dScroll: call EnableScrollBar, , SB_VERT, ESB_ENABLE_BOTH
@@eom:



Probably there is a better way but It work.

B7
Posted on 2003-11-29 07:48:01 by Bit7
Nice! Thanks for sharing :alright:

Regards,
Posted on 2003-11-29 22:12:27 by CYDONIA