Thank you for any helps!
HTH,
Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
"Saitama" <Sai...@discussions.microsoft.com> wrote in message
news:5F374768-9F19-40E4...@microsoft.com...
Unfortunately, the OP merely said the values were not 0, and did not feel it was
worthwhile to state what the values actually were. Why is it so hard to give complete
information?
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
If list view style is LVS_NOSCROLL then no scroll bars are used.
Using code presented by Serge is perfectly legal and will return proper
information.
However, GetScrollBarInfo gives all information about scrollbars.
I thing Saitama’s problem is not initializing SCROLLBARINFO structure.
At least cbSize should be initialized to a sizeof(SCROLLBARINFO).
On successful call to GetScrollBarInfo region[0] member returns state and if
state shows that bar is visible other members will show valid information.
--
RainMan
So you should be able to ask for SB_HORZ or SB_VERT as appropriate. I do this, and see my
essay on working around a bug in the SysListView32 control as far as dealing with
horizontal scrolling.
joe
On Wed, 17 Dec 2008 09:01:03 -0800, RainMan <Rai...@online.nospam> wrote:
>Joe, I am not sure what control you are referring to. List view control
>(SysListView32) does not use scroll bar control. Scroll bars are drawn as
>they are needed.
>
>If list view style is LVS_NOSCROLL then no scroll bars are used.
>
>Using code presented by Serge is perfectly legal and will return proper
>information.
>However, GetScrollBarInfo gives all information about scrollbars.
>I thing Saitama’s problem is not initializing SCROLLBARINFO structure.
>At least cbSize should be initialized to a sizeof(SCROLLBARINFO).
>On successful call to GetScrollBarInfo region[0] member returns state and if
>state shows that bar is visible other members will show valid information.
>Joe, I am not sure what control you are referring to. List view control
>(SysListView32) does not use scroll bar control. Scroll bars are drawn as
>they are needed.
****
At no point did I actually refer to "scroll bar controls", I referred to scroll bar
information, which would be true if the window has scrolling capability.
joe
****
>
>If list view style is LVS_NOSCROLL then no scroll bars are used.
>
>Using code presented by Serge is perfectly legal and will return proper
>information.
>However, GetScrollBarInfo gives all information about scrollbars.
>I thing Saitama’s problem is not initializing SCROLLBARINFO structure.
>At least cbSize should be initialized to a sizeof(SCROLLBARINFO).
>On successful call to GetScrollBarInfo region[0] member returns state and if
>state shows that bar is visible other members will show valid information.
Actually, that does not seem to be the case. I just did a test, and the code
that Serge gave worked as expected. Whenever the scrollbar was displayed, the
list control had the scroll style, and when it was not displayed, it did not. I
guess that the control sets or clears that style when it determines whether or
not it needs to display the scrollbar; makes sense.
Here’s another solution that works:
int w = 0;
for (int i = 0; i < m_List.GetHeaderCtrl()->GetItemCount(); i++)
w+=m_List.GetColumnWidth(i);
CRect rect(0,0,0,0);
m_List.GetClientRect(&rect);
bool bHScroll = w <= rect.Width();
bool bVScroll = m_List.GetItemCount() <= m_List.GetCountPerPage();
HTH
--
Alec S.
news/alec->synetech/cjb/net
> On Wed, 10 Dec 2008 09:15:08 +0100, "Serge Wautier" <se...@wautier.nospam.net>
wrote:
>
> > bool bHScroll = (m_List.GetStyle()&WS_HSCROLL)!=0;
> > bool bVScroll = (m_List.GetStyle()&WS_VSCROLL)!=0;
>
> >"Saitama" <Sai...@discussions.microsoft.com> wrote in message