From: Preeteesh on
Hi,

I am using TreeView Control in MFC Dialog based application. When i add
option to show checkbox in TreeControl, it shows a Horizontal ScrollBar
unnecessarily. How can i make it come only when data is long enough for it to
be there..? I google and found something like TVS_NOHSCROLL but cant find a
way to use it. Also cant find anything about it on MSDN. Please help.

Thanks.


From: GT on
"Preeteesh" <Preeteesh(a)discussions.microsoft.com> wrote in message
news:059F338F-4092-41A5-A058-F6737DC4FE09(a)microsoft.com...
> Hi,
>
> I am using TreeView Control in MFC Dialog based application. When i add
> option to show checkbox in TreeControl, it shows a Horizontal ScrollBar
> unnecessarily. How can i make it come only when data is long enough for it
> to
> be there..? I google and found something like TVS_NOHSCROLL but cant find
> a
> way to use it. Also cant find anything about it on MSDN. Please help.

Do you have any elements in your tree? You might see the scroll bar if the
tree is empty. If there are elements in the tree, then the scroll bar should
only appear when necessary - perhaps an element out of the visible area of
your tree is wider than the box?

You can use the TVS_ styles in the Create method. Look at the example at the
bottom of this page and you can add your TVS_ style in there:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_ctreectrl.3a3a.create.asp


From: Preeteesh on
Thanks for your reply. Actually i have created a variable for TreeviewControl
which is there in my Dailog. If i set Checkbox true intially, i mean though
GUI it show horizontal ScrollBar uncessarly, if i just set it using
m_Test->ModifyStyle(0, TVS_CheckBox); it works fine. Anyway thanks for urs
replies..

"GT" wrote:

> "Preeteesh" <Preeteesh(a)discussions.microsoft.com> wrote in message
> news:059F338F-4092-41A5-A058-F6737DC4FE09(a)microsoft.com...
> > Hi,
> >
> > I am using TreeView Control in MFC Dialog based application. When i add
> > option to show checkbox in TreeControl, it shows a Horizontal ScrollBar
> > unnecessarily. How can i make it come only when data is long enough for it
> > to
> > be there..? I google and found something like TVS_NOHSCROLL but cant find
> > a
> > way to use it. Also cant find anything about it on MSDN. Please help.
>
> Do you have any elements in your tree? You might see the scroll bar if the
> tree is empty. If there are elements in the tree, then the scroll bar should
> only appear when necessary - perhaps an element out of the visible area of
> your tree is wider than the box?
>
> You can use the TVS_ styles in the Create method. Look at the example at the
> bottom of this page and you can add your TVS_ style in there:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_ctreectrl.3a3a.create.asp
>
>
>