Connecting Tech Pros Worldwide Forums | Help | Site Map

TreeView Control: How to force tb scrolled left?

(PeteCresswell)
Guest
 
Posts: n/a
#1: Jul 15 '06
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

tommaso.gastaldi@uniroma1.it
Guest
 
Posts: n/a
#2: Jul 15 '06

re: TreeView Control: How to force tb scrolled left?


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:
Quote:
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
(PeteCresswell)
Guest
 
Posts: n/a
#3: Jul 16 '06

re: TreeView Control: How to force tb scrolled left?


Per tommaso.gastaldi@uniroma1.it:
Quote:
>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
tommaso.gastaldi@uniroma1.it
Guest
 
Posts: n/a
#4: Jul 16 '06

re: TreeView Control: How to force tb scrolled left?


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:
Quote:
Per tommaso.gastaldi@uniroma1.it:
Quote:
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
(PeteCresswell)
Guest
 
Posts: n/a
#5: Jul 16 '06

re: TreeView Control: How to force tb scrolled left?


Per tommaso.gastaldi@uniroma1.it:
Quote:
>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
(PeteCresswell)
Guest
 
Posts: n/a
#6: Jul 16 '06

re: TreeView Control: How to force tb scrolled left?


Per (PeteCresswell):
Quote:
>type of TreeView object
MSComctlLib.TreeCtrl.2
--
PeteCresswell
tommaso.gastaldi@uniroma1.it
Guest
 
Posts: n/a
#7: Jul 16 '06

re: TreeView Control: How to force tb scrolled left?


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:
Quote:
Per (PeteCresswell):
Quote:
type of TreeView object
>
MSComctlLib.TreeCtrl.2
--
PeteCresswell
(PeteCresswell)
Guest
 
Posts: n/a
#8: Jul 16 '06

re: TreeView Control: How to force tb scrolled left?


Per tommaso.gastaldi@uniroma1.it:
Quote:
>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
tommaso.gastaldi@uniroma1.it
Guest
 
Posts: n/a
#9: Jul 17 '06

re: TreeView Control: How to force tb scrolled left?


Perhaps time to move to the .net ? :-)

(PeteCresswell) ha scritto:
Quote:
Per tommaso.gastaldi@uniroma1.it:
Quote:
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
Closed Thread


Similar Microsoft Access / VBA bytes