views:

174

answers:

2

I have a rather lengthy tree view (IWTreeView) in a IWRegion (ClipRegion:= True) with one node selected. How do I focus that node such that it is visible for the user after a render? The

What I do so far:

In Delphi

tree.Selected:= itemToFocus;
tree.ScrollToName:= tree.Selected.Name;

This generates this on my website (done by IWTreeView.pas by Atozed):

<script language="javascript">
  ...
  function initialize {
    ...
    positionNAVIGATORTree( "i2" );
  }
</script>
...
<script language="javascript">
  function positionNAVIGATORTree( iNodeID )
  {
    FindElem( "NAVIGATOR").scrollTop =
      FindElem( iNodeID ).offsetTop - 40;
     return true;
  }
</script>

Still the tree after a render will show the topmost item. This is true for all browsers I have tested (IE8, Firefox, Chrome).

A: 

The javascript function window.scrollTo(x,y) allows you to scroll a window, will that work for your control?

skamradt
A: 

Elite Suite (recently open-sourced) has much better treeview (TArcIWStringGrid+TArcIWStringGridTreeContent) with perfectly working selection and scrolling. Try it!

Extender