TreeView Control on a Tab Control Loses its Position

G

Guest

Hello:

We have 3 treeviews on a tab of a TabControl. When we update the Treeview
under certain circumstances (which I have not yet figured out), the 3
treeviews move to position (0,0).

This appears to be a time-dependent problem, because when in the debugger
with breakpoints, it sometimes goes away, but even that is not consistent.

does anyone know of a known problem with TreeViews on a TabControl?

thank you in advance,
Harvey
 
S

Stefan Hoffmann

hi Harvey,
We have 3 treeviews on a tab of a TabControl. When we update the Treeview
under certain circumstances (which I have not yet figured out), the 3
treeviews move to position (0,0).
It's not a feature, it's a bug. Google for it.


mfG
--> stefan <--
 
G

Guest

Hi Stefan:

Could you give me one such link or article? I've been googling (e.g.,
treeview position error, etc.) for 10 minutes w/o success.
thank you
 
S

Stefan Hoffmann

hi Harvey,
Could you give me one such link or article? I've been googling (e.g.,
treeview position error, etc.) for 10 minutes w/o success.
thank you
iirc it depends on the version of the installed mscomctl.dll.

mfG
--> stefan <--
 
G

Guest

I have received some other solutions for this problem, which apparently
happens with the ListView control as well. Possible workarounds are:

- If you made the form unbound or put the TreeView Control in a
subform, the behavior did not occur.
- Try using the TreeView Control version 5.0 SP2 instead of
version 6.0 SP4.
- Removing Me.Requery on the OnOpen event of the form could also
help to resolve the problem.
- Try the code written below

Dim intCurrPage As Integer

Private Sub Form_Current()
intCurrPage = Me!TabCtl62.Value
RefreshPages
Me!TabCtl62.Pages(intCurrPage).SetFocus
End Sub

Private Sub Form_Timer()
RefreshPages
End Sub

Sub RefreshPages()
Dim i As Integer

For i = Me!TabCtl62.Pages.Count - 1 To 0 Step -1
Me!TabCtl62.Pages(i).SetFocus
Next i
Me.TimerInterval = 0
End Sub
 
G

Guest

.... but in the end, the only thing that worked for me was the following:

' Forms![Grant Information Access].pgCoding.SetFocus
Forms![Grant Information Access].pgCoding.SetFocus
Forms![Grant Information Access].pgSearch.SetFocus
Forms![Grant Information Access].pgCoding.SetFocus

the commented line shows what was originally there, but which caused the
treeview to show up in the 0,0 position. It took moving off that tab with
the treeview, to another tab, then back to the treeview tab. this did the
trick. Must be some sort of timing or refresh issue here. Users see no
palpable difference or flicker.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top