Ask a Question

How can I use scroll bar methods

SOLVED
MulgraveTester
Frequent Contributor

How can I use scroll bar methods

I have a script that uses [PageDown] to move from the top of a SysListView32 to the bottom. Unfortunately the [PageDown] key causes unwanted behaviour so I want to use the vertical scroll bar instead.

 

The SysListView32 has a CWnd_SetScrollPos method but there is no help for this and the function description shown in the object spy simply says:

"Function CWnd_SetScrollPos(Param1 as Integer, Param2 as Integer, Param3 as Integer) as Integer"

with no indication what each of the parameters are for.

 

Can you provide help on this and other scroll bar methods?

 

How else can I move the list using the vertical scroll bar?

11 REPLIES 11

That really seems to be right solution.

 

Just do minimum MouseWheel action until cell (or whatever you need) Visible on Screen property become 'True', smth. like that...

Doing things properly => getting proper results => getting profit
djadhav
Regular Contributor

What I usually do is this

 

'Prepare to know when to stop scrolling
'Identify an object on the top of the page/list to know that you've scrolled completely to the top
	SET objTop = objParent.FindChild(PropArray, ValuesArray, depth)
'Identify an object on the botton of the page/list to know that you've scrolled completely to the top
	SET objBottom = objParent.FindChild(PropArray, ValuesArray, depth)

'Scroll to the required object	
'Find the object that we are interested in 	
	SET objChild = objParent.FindChild(PropArray, ValuesArray, depth)
	IF objChild.VisibleOnScreen THEN
		'Do something with the object
	ELSE
		DO WHILE NOT objTop.VisibleOnScreen
			lib_MouseScrollUp(objPage,5) 'Find a number that sufficiently scrolls for you and use scroll up or down methods as required
			IF objChild.VisibleOnScreen THEN EXIT DO 
		LOOP
END IF

'Functions for scrolling

FUNCTION lib_MouseScrollUp(ByRef obj, ByVal count)
  obj.MouseWheel count
END FUNCTION

'OR

FUNCTION lib_MouseScrollDown(ByRef obj, ByVal count)  
  obj.MouseWheel 0-count
END FUNCTION

 

cancel
Showing results for 
Search instead for 
Did you mean: