473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8185
Actually the behavior you report is not the default. You are probably
doing some "EnsureVisi ble" 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 "EnsureVisi ble" 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.Sc rollable = False
'YOUR CODE HERE ...
Me.TreeView1.Sc rollable = 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 "EnsureVisi ble" 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.S crollable = 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.Tre eCtrl.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.Tre eCtrl.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.AddRang e...

or

theTree.Nodes.A ddRange
--------------------------------------------------
--
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.AddRang e...

or

theTree.Nodes.A ddRange
--------------------------------------------------
--
PeteCresswell
Jul 17 '06 #9

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

Similar topics

0
1318
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
1182
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 treeview. I am coming across 2 problems: 1) Forms event "Activated" does not trigger. Even when I force the event using f1.Activate, it does not execute the code inside the event.
6
3751
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 be refreshed. For now I just rebuild the tree entirely, which works, but it is collapsed and I don't know how to expand it to the node that has just been created. I'm struggling with that issue, so if someone has ever done that before, please...
2
2539
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 control into the view it is on the left side. Then I drag a Placeholder control and it is positioned below the Treeview control. Why is that?
7
9686
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 process of creating building up the tree from there. Only when I am done do I go over to the actual TreeView object on my form and add the my root to the TreeView. This sinlge step when I add my constructed root node to the form's TreeView control...
1
2064
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 displays some other windowed controls, however, not all are displayed initially when C1 is painted. for example C2 can be located on point
0
1988
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 with each TreeView node based upon a custom attribute I have included in the siteMapNode nodes of my .sitemap file. This all works as desired, including the security trimming which is especially desired behavior. The nodes of the TreeView...
3
2514
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 the page to select an option from my user control. Can I make this user control floatable so that as the user scrolls down the page the user control moves down also?
2
5503
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 programmatically. And I want to bind the selection of a TreeNode (which is a record) from the database) to a DetailsView which shows the datatable record for the selected TreeView node in the Details View. I am using IDE : Visual Web Developer 2005 Express; OS=...
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.