|
-
Nov 11th, 2002, 09:22 AM
#1
Thread Starter
Member
TreeView MouseOver Node
Hello!
Perhaps theres someone in the who is able to help me .....
I use a TreeView (MS Common Controls 5.0 (SP2)), and it works fine so far.
But: I need something witch displays Fond.Underlined and a Userdefined MouesIcon when the Users Mousepointer is over a spezified Node of the TreeView.
This is what i have done so far:
(Makes the spezified Node selected)
Code:
Private Sub tvwModule_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim nodX As Node
Set nodX = tvwModule.HitTest(X, Y)
If Not nodX Is Nothing Then
If Not nodX.Parent Is Nothing Then
If Not nodX.Child Is Nothing Then
Else
' Only BabyNode will be selected
nodX.Selected = True
End If
End If
End If
Set nodX = Nothing
End Sub
There is a second Problem I cant resolve:
(Maybe Simple)
How do I make sure the TreeView first Row is displayed, even when the TreeView has Scrollbars?
Right now it seems the TreeViews Scrollbars are scrolled to the middle of the TreeView, I want them at the Begin of the Control, e.G. at TreeViews Top and Left.
Any ideas?
Thanks in Advanced,
MyVar.
-
Nov 11th, 2002, 10:59 AM
#2
Fanatic Member
This is to answer the second part.
dim nd as node
set nd = tvtreeview.nodes(1)
nd.select = true
nd.ensurevisible = true
-
Nov 11th, 2002, 12:56 PM
#3
Thread Starter
Member
ScrollBars
Thx, Dalceon. The second Problem is resolved. It works fine that Way.
I just made some adjustments:
Code:
tvwModule.Nodes.Item(1).Selected = True
Set nodX = tvwModule.Nodes(1)
nodX.Selected = True
nodX.EnsureVisible
Now, some Ideas for the Primary Problem?
Thanks in Advance,
MyVar.
-
Nov 11th, 2002, 02:27 PM
#4
Fanatic Member
this does most of what you want.
without getting into some very complicated stuff, you can't underline individual items as far as I know.
be sure to set the mouseicon under the picture tab of the properties page.
let me know if this is what you need.
VB Code:
Option Explicit
Dim previousnodx As Node
Private Sub Form_Load()
Dim i As Long
Dim nd As Node
Dim x As Integer
Dim nd2 As Node
For i = 1 To 10
Set nd = tvwModule.Nodes.Add(, , , "Number " & i)
For x = 1 To 3
Set nd2 = tvwModule.Nodes.Add(nd, tvwChild, , "Child " & x)
Next
Next
End Sub
Private Sub tvwModule_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim nodX As Node
Set nodX = tvwModule.HitTest(x, Y)
If Not nodX Is Nothing Then
If Not previousnodx Is Nothing Then
previousnodx.Bold = False
End If
Set previousnodx = nodX
If nodX.Parent Is Nothing Then
tvwModule.MousePointer = ccArrow
nodX.Bold = False
LockWindowUpdate 0&
Else
' Only BabyNode will be selected
nodX.Selected = True
tvwModule.MousePointer = 99
nodX.Bold = True
LockWindowUpdate 0&
End If
Else
tvwModule.MousePointer = ccArrow
End If
Set nodX = Nothing
End Sub
-
Nov 11th, 2002, 04:38 PM
#5
Thread Starter
Member
[Three-Quater Solved] Not exactly what I want but ...
Thanks Dalceon!
This is not exactly what I am looking for but I like it!
I have made some Adjustments, because .Bold didnt worked for me and *OhHowLuckyIam* there is no flickering, so I cleared out LockWindowUpdate.
Since I have a 3 Dimension TreeView:
+Root
||
|+Child
||
|||+Babys
|
+Root
||
|+Child
|
+Root
||
|+Child
||
|||+Babys
|
+Root
and using Common Controls 5.0 SP2, this workes for me:
Code:
Private Sub tvwModule_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim nodX As Node
Set nodX = tvwModule.HitTest(X, Y)
If Not nodX Is Nothing Then
tvwModule.MousePointer = ccArrow
If Not nodX.Parent Is Nothing Then
tvwModule.MousePointer = ccArrow
If Not nodX.Child Is Nothing Then
tvwModule.MousePointer = ccArrow
Else
tvwModule.MousePointer = 99
tvwModule.MouseIcon = LoadPicture(App.Path & _
"\" & "Ressourcen\handkleinweiss.cur")
End If
End If
nodX.Selected = True
Else
tvwModule.MousePointer = ccArrow
End If
Set nodX = Nothing
End Sub
Now each Node is Selected when the Mousepointer moves over them, but only over BabyNodes the MouseIcon is a WhiteHand.
If you wanna see how it looks like now
While only behind BabyNodes there is Code to be performed, this is a good Way to improve usability.
It would be nice to show the BabyNodes Underlined, mabe there is a Way to do it simply? I do not wanna use 3.Party Components or a Ton of API Calls.
If not, no Matter what. : )
Thanks in Advanced,
MyVar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|