Racing effect on treeview

Started by Jonathan Bristow, November 12, 2006, 02:37:53 PM

Previous topic - Next topic

Jonathan Bristow

I have a treeview and a listview.
The treeview holds a number of items and when selected a breakdown is displayed in the listview.
I can select a breakdown in the treeview by either moving the marker through the items with the cursor keys or selecting one with the mouse.
However, if i hold the Down key(or Up key), the marker moves down and the listview code does not have time to display all the details. This results in a program freeze. What exactly happens is strange. The treeview freezes whilst the listview appears to fill up infinitately.

The code that interprets the marker change in the treeview is in the TVN_SELCHANGED callback. No other callback is used for the treeview.

I would put the code into a separate subroutine then call it from lbuttonup or key_up callbacks if only the listview had a key_up callback but firefly suggests it does not.

This utility needs to operate both from Keyboard and through mouse control.
I'm pretty sure it is something very silly i am doing  :oops: , but as yet, i don't see what it is.

TechSupport

I guess that you are sending too many requests to your Listview to update. Maybe you can try this:

- Create a global variable, say, gUpdating as Long
- In the TVN_SELCHANGING message handler do something like this:

' Do not allow the Treeview to change until the ListView updates
If IsTrue(gUpdating) Then
  Function = %TRUE: Exit Function
End If


In your code that does the ListView updating put a gUpdating = %TRUE at the start of the routine and a gUpdating = %FALSE at the end of the routine.

Notice that my approach is using the TVN_SELCHANGING notification and not the TVN_SELCHANGED notification.

Hope it works.... I haven't tried it with any live code.

Jonathan Bristow

It turned out that a third party driver was causing the glitch. Have now sorted the issue. Apologies for the mistake.