15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Getting rid of tree control scroll bar

Paul B -- Paul.B.Folbrecht@JCI.Com
Tuesday, February 25, 1997

     Environment: VC++ 4.1, NT 4.0
     
     I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing synchronized 
     vertical scrolling using the right pane's scrollbar.  So, I don't want 
     the tree to have a vertical scrollbar. But it doesn't want to go away. 
     Turning off WM_VSCROLL has no effect.  What I do is call 
     ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this works, but
     the bar shows up for an instant and it looks bad.  How can I get rid 
     of it altogether?
     
     -Paul Folbrecht
     Compuware Corp.



Mario Contestabile -- Mario_Contestabile.UOS__MTL@UOSMTL2.universal.com
Wednesday, February 26, 1997

> So, I don't want 
  >  the tree to have a vertical scrollbar. But it doesn't want to go away. 
   > Turning off WM_VSCROLL has no effect.  

You can make scroll bars invisible by setting the upper limit of its range
equal to the lower limit.

mcontest@universal.com




Gonzalo Isaza -- gonzaloi@microsoft.com
Wednesday, February 26, 1997

[Mini-digest: 3 responses]

Use CWnd::ShowScrollBar to show/hide the scrollbars and you won't have
to mess around with the scrollbar limits.

Gonzalo
I speak for myself.  I do not speak for Microsoft.

>----------
>From: 	Mario Contestabile[SMTP:Mario_Contestabile.UOS__MTL@universal.com]
>Sent: 	Wednesday, February 26, 1997 8:53 AM
>To: 	Paul.B.Folbrecht
>Cc: 	mfc-l
>Subject: 	Re: Getting rid of tree control scroll bar
>
>> So, I don't want 
>  >  the tree to have a vertical scrollbar. But it doesn't want to go away. 
>   > Turning off WM_VSCROLL has no effect.  
>
>You can make scroll bars invisible by setting the upper limit of its range
>equal to the lower limit.
>
>mcontest@universal.com
>
>
-----From: Paul.B.Folbrecht@jci.com


     I mentioned in the original message that that doens't solve the 
     problem.  I want the scrollbar in my tree control to never show up.  
     As soon as an item is expanded or the window resized so that the 
     treectrl items don't fit, it shows the bar.  I'm using ShowScrollBar 
     to hide it, but it is still drawn briefly.
     
     -Paul Folbrecht
     Compuware Corp.
     


______________________________ Reply Separator _________________________________
Subject: RE: Getting rid of tree control scroll bar
Author:  gonzaloi@microsoft.com at Mailhub
Date:    2/26/97 4:18 PM


Use CWnd::ShowScrollBar to show/hide the scrollbars and you won't have 
to mess around with the scrollbar limits.
     
Gonzalo
I speak for myself.  I do not speak for Microsoft.
     
>----------
>From:  Mario Contestabile[SMTP:Mario_Contestabile.UOS__MTL@universal.com] 
>Sent:  Wednesday, February 26, 1997 8:53 AM
>To:    Paul.B.Folbrecht
>Cc:    mfc-l
>Subject:       Re: Getting rid of tree control scroll bar 
>
>> So, I don't want
>  >  the tree to have a vertical scrollbar. But it doesn't want to go away. 
>   > Turning off WM_VSCROLL has no effect.
>
>You can make scroll bars invisible by setting the upper limit of its range 
>equal to the lower limit.
>
>mcontest@universal.com
>
>
-----From: Paul.B.Folbrecht@jci.com


     Nope, this doesn't work.  The tree control handles scrolling itself, 
     so it is setting the scroll range internally.  


______________________________ Reply Separator _________________________________
Subject: Re: Getting rid of tree control scroll bar
Author:  Mario_Contestabile.UOS__MTL@universal.com at Mailhub
Date:    2/26/97 4:41 PM


> So, I don't want
  >  the tree to have a vertical scrollbar. But it doesn't want to go away.
   > Turning off WM_VSCROLL has no effect.
     
You can make scroll bars invisible by setting the upper limit of its range 
equal to the lower limit.
     
mcontest@universal.com



Ajay K Sanghi -- sanghi@giasdl01.vsnl.net.in
Thursday, February 27, 1997

[Mini-digest: 5 responses]


Hi,
First check whether you have turned off the WM_SCROLL style for 
TreeView or TreeCtrl.
For doing it to TreeCtrl, we use m_DefaultStyle member of
CTreeView  whereas doing it to TreeView we use dwStyle member of 
CREATESTRUCT structure in CMyTreeView::PreCreateWindow(CREATESTRUCT&).
If you have done it to TreeCtrl using m_DefaultStyle data member then
try this code in OnCreate of your CTreeView Derrived 
class. 
CMyTreeView::OnCreate()
{
	//CAll Base class OnCreate();
	CTreeCtrl& TreeCtrl = GetTreeCtrl();
	CScrollBar* pScroll = TreeCtrl.GetScrolBarCtrl(SB_VERT);
	pScroll->ShowWindow( SW_HIDE );
	pScroll->SetRedraw( FALSE );
}

By Calling SetRedraw(FALSE), this Scrollbar will not be painted till you call
SetRedraw( TRUE ) which , in your case , is not required.
I'm not a window's expert but I think this seems logical.
Ashok, 



On Tue, 25 Feb 1997 Paul.B.Folbrecht@JCI.Com wrote:

>      Environment: VC++ 4.1, NT 4.0
>      
>      I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing synchronized 
>      vertical scrolling using the right pane's scrollbar.  So, I don't want 
>      the tree to have a vertical scrollbar. But it doesn't want to go away. 
>      Turning off WM_VSCROLL has no effect.  What I do is call 
>      ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this works, but
>      the bar shows up for an instant and it looks bad.  How can I get rid 
>      of it altogether?
>      
>      -Paul Folbrecht
>      Compuware Corp.
> 
-----From: Laurent Mouton 

I used the folllowing in a CTreeView-derivative to get rid of the
horizontal scroll bar :

void CivArbreView::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS
FAR* lpncsp)=20
{
	ModifyStyle( WS_HSCROLL, 0 );
	CivTreeView::OnNcCalcSize(bCalcValidRects, lpncsp);
}

Laurent Mouton
In Visio
21 avenue Fran=E7ois Favre
74000 ANNECY
Tel: 33+ (0) 4 50 27 80 32
Fax: 33+ (0) 4 50 23 35 07

>----------
>De : 	Paul.B.Folbrecht@JCI.Com[SMTP:Paul.B.Folbrecht@JCI.Com]
>Date :	mardi 25 f=E9vrier 1997 17:12
>A :	mfc-l@netcom.com
>Objet :	Getting rid of tree control scroll bar
>
>     Environment: VC++ 4.1, NT 4.0
>    =20
>     I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing =
synchronized=20
>     vertical scrolling using the right pane's scrollbar.  So, I don't =
want=20
>     the tree to have a vertical scrollbar. But it doesn't want to go =
away.=20
>     Turning off WM_VSCROLL has no effect.  What I do is call=20
>     ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this works, =
but
>     the bar shows up for an instant and it looks bad.  How can I get =
rid=20
>     of it altogether?
>    =20
>     -Paul Folbrecht
>     Compuware Corp.
>
-----From: Kostya Sebov 

----------
From: 	Paul.B.Folbrecht@JCI.Com
Sent: 	Tuesday, February 25, 1997 18:12
To: 	mfc-l@netcom.com
Subject: 	Getting rid of tree control scroll bar

     Environment: VC++ 4.1, NT 4.0
     
     I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing synchronized 
     vertical scrolling using the right pane's scrollbar.  So, I don't want 
     the tree to have a vertical scrollbar. But it doesn't want to go away. 
     Turning off WM_VSCROLL has no effect.  What I do is call 
=======================
You mean WS_VSCROLL (the _style_ bit), don't you?
=======================
     ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this works, but
     the bar shows up for an instant and it looks bad.  How can I get rid 
     of it altogether?
     
     -Paul Folbrecht
     Compuware Corp.

=================
HTH,
	Kostya Sebov. 
----------------------------------------------------------------------------
Tel: +(38 044) 266-6387 /work/,   +(38 044) 513-2591 /home/
mailto: sebov@is.kiev.ua
---------------------------------------------------------------------------
Leading programmer 
Intelligent Systems (Boston-Kiev)
voice/fax: +(38 044)266-6195
mailto: company@is.kiev.ua
http://www.i-rip.com




-----From: Vinay Desai 

I'm not quite sure how your application is really setup, but one way to
make the scroll bars invisible is to set the minimum range = maximum
range =0.  This effectively hides the scroll bar.  You can bring it back by
changing the ranges again later.

HTH.



>>>  02/25/97 11:12am >>>
     Environment: VC++ 4.1, NT 4.0
     
     I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing
synchronized 
     vertical scrolling using the right pane's scrollbar.  So, I don't want 
     the tree to have a vertical scrollbar. But it doesn't want to go away. 
     Turning off WM_VSCROLL has no effect.  What I do is call 
     ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this
works, but
     the bar shows up for an instant and it looks bad.  How can I get rid 
     of it altogether?
     
     -Paul Folbrecht
     Compuware Corp.

-----From: Paul.B.Folbrecht@jci.com


     

Yes, that was a typo.  I meant WS_VSCROLL.

______________________________ Reply Separator _________________________________
Subject: RE: Getting rid of tree control scroll bar
Author:  sebov@is.kiev.ua at Mailhub
Date:    2/27/97 6:11 AM


----------
From:   Paul.B.Folbrecht@JCI.Com
Sent:   Tuesday, February 25, 1997 18:12 
To:     mfc-l@netcom.com
Subject:        Getting rid of tree control scroll bar
     
     Environment: VC++ 4.1, NT 4.0
     
     I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing synchronized 
     vertical scrolling using the right pane's scrollbar.  So, I don't want 
     the tree to have a vertical scrollbar. But it doesn't want to go away. 
     Turning off WM_VSCROLL has no effect.  What I do is call
=======================
You mean WS_VSCROLL (the _style_ bit), don't you? 
=======================
     ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this works, but 
     the bar shows up for an instant and it looks bad.  How can I get rid 
     of it altogether?
     
     -Paul Folbrecht
     Compuware Corp.
     
=================
HTH,
        Kostya Sebov.
---------------------------------------------------------------------------- 
Tel: +(38 044) 266-6387 /work/,   +(38 044) 513-2591 /home/
mailto: sebov@is.kiev.ua
--------------------------------------------------------------------------- 
Leading programmer
Intelligent Systems (Boston-Kiev)
voice/fax: +(38 044)266-6195
mailto: company@is.kiev.ua
http://www.i-rip.com



Doncho Angelov -- alian@plovdiv.techno-link.com
Thursday, February 27, 1997

[Mini-digest: 3 responses]

You can do EnableScrollBarCtrl(SB_HORZ, FALSE) and the same fot he =
vertical one (I think that was the name - look in CWnd documentation) =
with OnInitialUpdate of your view. That should work. If it doesn't, you =
could follow the advise to set the limits equal (don't forget that =
CTreeView is inherited from CFormView, which is inherited from =
CScrollView :-) ).

Regards !

Dony

----------
From: 	Paul.B.Folbrecht@JCI.Com[SMTP:Paul.B.Folbrecht@JCI.Com]
Sent: 	Tuesday, February 25, 1997 12:12 PM
To: 	mfc-l@netcom.com
Subject: 	Getting rid of tree control scroll bar

     Environment: VC++ 4.1, NT 4.0
    =20
     I'm using a CTreeView in a 1x2 CSplitterWnd.  I am doing =
synchronized=20
     vertical scrolling using the right pane's scrollbar.  So, I don't =
want=20
     the tree to have a vertical scrollbar. But it doesn't want to go =
away.=20
     Turning off WM_VSCROLL has no effect.  What I do is call=20
     ShowScrollBars( SB_VERT, FALSE ) in OnItemExpanded();  this works, =
but
     the bar shows up for an instant and it looks bad.  How can I get =
rid=20
     of it altogether?
    =20
     -Paul Folbrecht
     Compuware Corp.

-----From: Paul.B.Folbrecht@jci.com


     
I believe I replied to another reply that suggested this method, but it doesn't 
work.  The tree control shows the bar again as soon as you size it or expand an 
item.

-Paul Folbrecht
Compuware Corp.

______________________________ Reply Separator _________________________________
Subject: RE: Getting rid of tree control scroll bar
Author:  gonzaloi@MICROSOFT.com at Mailhub
Date:    2/27/97 12:32 PM


[Mini-digest: 3 responses]
     
Use CWnd::ShowScrollBar to show/hide the scrollbars and you won't have 
to mess around with the scrollbar limits.
     
Gonzalo
I speak for myself.  I do not speak for Microsoft.
     
>----------
>From:  Mario Contestabile[SMTP:Mario_Contestabile.UOS__MTL@universal.com] 
>Sent:  Wednesday, February 26, 1997 8:53 AM
>To:    Paul.B.Folbrecht
>Cc:    mfc-l
>Subject:       Re: Getting rid of tree control scroll bar 
>
>> So, I don't want
>  >  the tree to have a vertical scrollbar. But it doesn't want to go away. 
>   > Turning off WM_VSCROLL has no effect.
>
>You can make scroll bars invisible by setting the upper limit of its range 
>equal to the lower limit.
>
>mcontest@universal.com
-----From: Paul.B.Folbrecht@jci.com


     


     
     
Hi,
First check whether you have turned off the WM_SCROLL style for 
TreeView or TreeCtrl.
For doing it to TreeCtrl, we use m_DefaultStyle member of 
CTreeView  whereas doing it to TreeView we use dwStyle member of
CREATESTRUCT structure in CMyTreeView::PreCreateWindow(CREATESTRUCT&). 
If you have done it to TreeCtrl using m_DefaultStyle data member then 
try this code in OnCreate of your CTreeView Derrived
class.
CMyTreeView::OnCreate()
{
        //CAll Base class OnCreate();
        CTreeCtrl& TreeCtrl = GetTreeCtrl();
        CScrollBar* pScroll = TreeCtrl.GetScrolBarCtrl(SB_VERT); 
        pScroll->ShowWindow( SW_HIDE );
        pScroll->SetRedraw( FALSE );
}
     
By Calling SetRedraw(FALSE), this Scrollbar will not be painted till you call 
SetRedraw( TRUE ) which , in your case , is not required.
I'm not a window's expert but I think this seems logical. 
Ashok,
     -----------------------------------------------
     
     Nope, this doesn't work.  I don't know if you actually tried this, but 
     for me GetScrollBarCtrl() always returns NULL, which is what the docs 
     imply it will do.  It doesn't deal with scrollbars created from window 
     styles.
     
     

-----From: Laurent Mouton 
     
I used the folllowing in a CTreeView-derivative to get rid of the 
horizontal scroll bar :
     
void CivArbreView::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS 
FAR* lpncsp)=20
{
        ModifyStyle( WS_HSCROLL, 0 );
        CivTreeView::OnNcCalcSize(bCalcValidRects, lpncsp);
}
     
-----------------------------------------------

This DOES work.  Man, I never would have thought of that.  This is obviously 
something that could have been made simpler.

-Paul Folbrecht
Compuware Corp.




Become an MFC-L member | Вернуться в корень Архива |