473,396 Members | 1,777 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

TreeView Control: How to force tb scrolled left?

I've got a TreeView in which I present a rather wide line of info for some
branches. The user doesn't care to see all the info all of the time and we're
tight on horizontal screen space, so we've elected to just let the user scroll
right if they want to see more info.

The glitch is that we open up the form and populate the TreeView control, it is
left in a scrolled state - in this case, just enough to hide the plus signs that
indicate child nodes...

Seems like there should be a way to keep the horizontal scroll bar, but force it
all the way left after we populate the TreeView... I'm guessing I could dope
something out using SendKeys, but I'd rather not go there if I don't have to.

Some hidden method/property?
--
PeteCresswell
Jul 15 '06 #1
8 8169
Actually the behavior you report is not the default. You are probably
doing some "EnsureVisible" after adding a node, to cause the scroll.

Remove it, to avoid scrolling. If possible use .addrange and do node
selection / ensurevisible when finished adding nodes. Let me know...

-tom

(PeteCresswell) ha scritto:
I've got a TreeView in which I present a rather wide line of info for some
branches. The user doesn't care to see all the info all of the time and we're
tight on horizontal screen space, so we've elected to just let the user scroll
right if they want to see more info.

The glitch is that we open up the form and populate the TreeView control, it is
left in a scrolled state - in this case, just enough to hide the plus signs that
indicate child nodes...

Seems like there should be a way to keep the horizontal scroll bar, but force it
all the way left after we populate the TreeView... I'm guessing I could dope
something out using SendKeys, but I'd rather not go there if I don't have to.

Some hidden method/property?
--
PeteCresswell
Jul 15 '06 #2
Per to**************@uniroma1.it:
>Actually the behavior you report is not the default. You are probably
doing some "EnsureVisible" after adding a node, to cause the scroll.

Remove it, to avoid scrolling. If possible use .addrange and do node
selection / ensurevisible when finished adding nodes. Let me know...
I did find/eliminate a .EnsureVisible - but it was in the Expand/Collapse All
routine that I had in place. And, indeed, after invoking that routine the
tree's horizontal scroll is now positioned so that the high-level plus signs are
visible as long as it was so positioned in the first place (it was indeed
getting scrolled with the .EnsureVisible applied..)

But .EnsureVisible does not seem to be the culprit when I'm building the tree
and haven't done any Expand/Collapse on it yet - at least when I do a "Find" on
the code for .EnsureVisible, there aren't any hits.

Gave .vScrollPolicy = "Off" a try, but that prop doesn't seem to exist on the
ComCtl tree.

--
PeteCresswell
Jul 16 '06 #3
If you just add nodes without any following selection / expansion /
ensurevisible
there is no way it would scroll.

Ensure that you do nothing when adding nodes and possibly use addrange
(which is much faster, as it would not fire events after each node
addition)
Finally, if you want to really cut away any problem you can do just one
simple thing:

Me.TreeView1.Scrollable = False
'YOUR CODE HERE ...
Me.TreeView1.Scrollable = True

this will prevent scrolling during the treeview building.

-t

(PeteCresswell) ha scritto:
Per to**************@uniroma1.it:
Actually the behavior you report is not the default. You are probably
doing some "EnsureVisible" after adding a node, to cause the scroll.

Remove it, to avoid scrolling. If possible use .addrange and do node
selection / ensurevisible when finished adding nodes. Let me know...

I did find/eliminate a .EnsureVisible - but it was in the Expand/Collapse All
routine that I had in place. And, indeed, after invoking that routine the
tree's horizontal scroll is now positioned so that the high-level plus signs are
visible as long as it was so positioned in the first place (it was indeed
getting scrolled with the .EnsureVisible applied..)

But .EnsureVisible does not seem to be the culprit when I'm building the tree
and haven't done any Expand/Collapse on it yet - at least when I do a "Find" on
the code for .EnsureVisible, there aren't any hits.

Gave .vScrollPolicy = "Off" a try, but that prop doesn't seem to exist on the
ComCtl tree.

--
PeteCresswell
Jul 16 '06 #4
Per to**************@uniroma1.it:
>Me.TreeView1.Scrollable = False
Different type of TreeView object, I guess:
-----------------------------------------------------------
Error# 438: Object doesn't support this property or method
-----------------------------------------------------------

This is getting "interesting".... -)
--
PeteCresswell
Jul 16 '06 #5
Per (PeteCresswell):
>type of TreeView object
MSComctlLib.TreeCtrl.2
--
PeteCresswell
Jul 16 '06 #6
hi Pete,

Yes, probably. I am most familiar with the treeview in .net framework
(and with that in asp.net). Perhaps, the treview is more complete there
and has properties and methods that are not available in the version
you are using. Look for something (if present) that would disable
scrolling while you build the tree. By chance, do you have available
the addrange() method?

-tom

(PeteCresswell) ha scritto:
Per (PeteCresswell):
type of TreeView object

MSComctlLib.TreeCtrl.2
--
PeteCresswell
Jul 16 '06 #7
Per to**************@uniroma1.it:
>By chance, do you have available
the addrange() method?
I'm guessing not, because it does not reveal itself in auto-completion.
e.g.
--------------------------------------------------
theTree.AddRange...

or

theTree.Nodes.AddRange
--------------------------------------------------
--
PeteCresswell
Jul 16 '06 #8
Perhaps time to move to the .net ? :-)

(PeteCresswell) ha scritto:
Per to**************@uniroma1.it:
By chance, do you have available
the addrange() method?

I'm guessing not, because it does not reveal itself in auto-completion.
e.g.
--------------------------------------------------
theTree.AddRange...

or

theTree.Nodes.AddRange
--------------------------------------------------
--
PeteCresswell
Jul 17 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oleg | last post by:
I have to know when the TreeView control is scrolled but I didn't find such event. Is there any option to know that the TreeView was scrolled? Thanks in advance
1
by: iqbal | last post by:
Hi, I am writting an application in outlook style which has Left Panel and a Right Panel. I have Treeview COntrol in left panel, and I load the forms in right panel on AfterSelect event of the...
6
by: Sam | last post by:
Hi, I've got a treeview on the left of my form, filled with data from a database, and the user can enter new data on the right side of the form. When the user saves the data, I'd like the tree to...
2
by: Bob | last post by:
I've got a MultiView with multiple Views. In one View, I want to display a Treeview on the left side and controls generated via a Placeholder control on the right side. If I drag a treeview...
7
by: tman | last post by:
I am generating a very large tree list in my program and while it's performance is great once loaded it takes a really long time to load. I create a root TreeNode "offline" and go through the...
1
by: --== Alain ==-- | last post by:
Hi, I have a question about drawing windowed control. For example, i have a windowed control, let's called it C1 (as container for example). its width = 300 px and height = 200 px. C1...
0
by: noneya22 | last post by:
I want to use a TreeView control as a one-level, vertical navigation menu. I'm using this control currently with a SiteMapDataSource and .sitemap file. I've written code that associates an image...
3
by: =?Utf-8?B?Qw==?= | last post by:
Hi, I have a user control which I use on all my pages. The control is situated on the top of my page (sits on my master page). For some long pages the user has to scroll back up to the top of...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.