Make your own free website on Tripod.com

The TreeView Scrolling Service For Dragging (26 oct 1997)

Back Up Next

Author: Eric Aling
Accessed:
Download: Download treeview.zip ( treeview.zip 3Kb ):

When you want to drag an object into a treeview, you automatically want the treeview to scroll when needed. This little service provides this functionality.

The service is called n_cst_tvsrv_dragscroll, which is inherited from the PB nonvisual object. I have incorporated this service into my u_tv object as follows:

  1. For u_tv, declare an instance variable inv_DragScroll of type n_cst_tvsrv_DragScroll.
  2. For the DragWithing event code:
if IsValid(inv_DragScroll) then
inv_DragScroll.Event ue_dragwithin(handle)
end if
  1. To start the service, create an objectfunction called of_DragScroll ( ab_switch boolean ) return integer:
if ab_Switch then
if not IsValid(inv_DragScroll) then
inv_DragScroll = create n_cst_tvsrv_DragScroll
inv_DragScroll.of_SetRequestor(This)
end if
else
if IsValid(inv_DragScroll) then
Destroy inv_DragScroll
end if
end if
return 1
  1. Code This.Of_DragScroll(FALSE) in the destructor event of u_tv so that the service will be destroyed ( if needed ) when the treeview control is destroyed.

 

That's all there is too it. To call the service, just code this.of_DragScroll(TRUE) in the constructor event of your treeview control.

Good luck!

 

Back Up Next