detecting a scrollbar's enablement... 
Author Message
 detecting a scrollbar's enablement...

Hi

I am fairly new to MFC dev. and have a problem that could be solved easily
if only I knew how to determine if a scrollbar is visible.  I am using a
CListCtrl and am filling it based on a dynamic data feed.

Thus I do not know how many rows will be coming in at any time, nor do I
know how big the user will size the frame of the window.  Depending on how
much data is listed versus the size of the view, I may need (or not need)
the scrollbar that automatically pops up.

My question is:  How can I determine if the scrollbar has become visible (or
active or enabled)?  Or can this even be done?  I haven't had much luck
finding this in MSDN.

Many thanks,

Ryan



Fri, 24 Oct 2003 06:26:46 GMT  
 detecting a scrollbar's enablement...

Quote:
>My question is:  How can I determine if the scrollbar has become visible (or
>active or enabled)?  Or can this even be done?  I haven't had much luck
>finding this in MSDN.

Ryan,

I don't know if this will help you, but I have a note of this code
that I tried a while ago...

Here's a simple test I've tried that seems to work OK for me. I've put
a list control in report mode in a dialog and populate it in
OnInitDialog:

for ( int indx = 0; indx < 10; indx++ )
{
        char szItem[20];

        wsprintf( szItem, "Item %d", indx+1 );
        pList->InsertItem( indx+1, szItem );

        SCROLLINFO si;

        if ( pList->GetScrollInfo( SB_VERT, &si ) )
        {
                if ( (int) si.nPage <= ( si.nMax - si.nMin ) )
                {
                        AfxMessageBox("Scroll Bar has appeared now");
                }
        }

Quote:
}

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.


Fri, 24 Oct 2003 19:38:41 GMT  
 detecting a scrollbar's enablement...
Many thanks to you David.  It now works much better than before.  The
original logic was much less precise.

Thanks again,

Ryan


Quote:
> >My question is:  How can I determine if the scrollbar has become visible
(or
> >active or enabled)?  Or can this even be done?  I haven't had much luck
> >finding this in MSDN.

> Ryan,

> I don't know if this will help you, but I have a note of this code
> that I tried a while ago...

> Here's a simple test I've tried that seems to work OK for me. I've put
> a list control in report mode in a dialog and populate it in
> OnInitDialog:

> for ( int indx = 0; indx < 10; indx++ )
> {
> char szItem[20];

> wsprintf( szItem, "Item %d", indx+1 );
> pList->InsertItem( indx+1, szItem );

> SCROLLINFO si;

> if ( pList->GetScrollInfo( SB_VERT, &si ) )
> {
> if ( (int) si.nPage <= ( si.nMax - si.nMin ) )
> {
> AfxMessageBox("Scroll Bar has appeared now");
> }
> }
> }

> Dave
> --
> MVP VC++ FAQ: http://www.mvps.org/vcfaq
> My address is altered to discourage junk mail.
> Please post responses to the newsgroup thread,
> there's no need for follow-up email copies.



Sun, 26 Oct 2003 03:10:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to detect that Scrollbar is showing on a Panel

2. How to detect the message from scrollbar

3. Detecting if scrollbar is shown

4. Detecting if scrollbar is shown

5. How to detect scrollbar appearance ?

6. Detecting 'File in Use'

7. Detect if project is 'using MFC'

8. ClistCtrl ScrollBar and ScrollBar range

9. How do I manipulate a CListCtrl's Scrollbar

10. How do I manipulate a CListCtrl's Scrollbar

11. Please help: can't detect an EOF while reading structures

12. Why doesn't SEH detect all memory exceptions

 

 
Powered by phpBB® Forum Software