| View previous topic :: View next topic |
| Author |
Message |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Oct 05, 2007 7:33 pm Post subject: How to move the horizontal scrollbar all the way to the left |
|
|
How to move the horizontal scrollbar all the way to the left?
I can get focus of the window that contains the scrollbar and
can move it with the VDS SEND(arrow keys) now.
But that method is to much like how the caveman would do it.
Mainly its too slow to wait for, and I would also like to be able to
change the resolution of movement(to fine tune its position).
Below is some code I found here:
//Scroll bar control//
SBM_GETSCROLLINFO 0x00EA
SBM_SETSCROLLINFO 0x00E9
SBM_GETPOS 0x00E1
SBM_SETPOS 0x00E0
SBM_GETRANGE 0x00E3
SBM_SETRANGEREDRAW 0x00E6
EXAMPLE: <below code did not work for me> | Code: | | %z = @sendmsg(@winexists(~L1),$00E0,2000,0) |
The last 4 digits are normally used in the @sendmsg() function with
a preceding "$". "L1" is the list box name.
Any help is appreciated  |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Oct 05, 2007 10:49 pm Post subject: |
|
|
vtol,
Try this instead. You really should get the range first.
| Code: |
#-----------------------------------------------------------------------------#
# #
# Demo of how to scroll a list box all the way to the right #
# #
# Author: Johnny Kinsey #
# #
# Copyright: Copyright © 2007 DragonSphere Software #
# #
#-----------------------------------------------------------------------------#
DIALOG CREATE,New Dialog,-1,0,240,160
REM *** Modified by Dialog Designer on 10/5/2007 - 17:51 ***
DIALOG ADD,LIST,L1,8,30,112,144
DIALOG SHOW
List Add,L1,This is a long string to get the scrollbar to show up
%A = @sendmsg(@winexists(~L1),$0194,2000,0)
%%SB_BOTH = 3
%%SB_CTL = 2
%%SB_HORZ = 0
%%SB_VERT = 1
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MaxPos,BOOL:1)
Wait 5
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MinPos,BOOL:1)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
:evloop
wait event
%E = @event()
If %E
goto %E
End
goto evloop
:CLOSE
Exit
|
_________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sat Oct 06, 2007 4:28 am Post subject: |
|
|
Johnny,
I've been playing with your code. | Code: | #-----------------------------------------------------------------------------#
# Demo of how to scroll a list box all the way to the right #
# Author: Johnny Kinsey #
# Copyright: Copyright © 2007 DragonSphere Software #
#-----------------------------------------------------------------------------#
DIALOG CREATE,Scrollbar Demo,-1,0,200,180,NOMIN
DIALOG ADD,LIST,L1,8,8,184,144
DIALOG ADD,STATUS,S1,[40]|
dialog SHOW
list Add,L1,This is a long string to get the scrollbar to show up
dialog set,S1,@tab()" "No Scrollbar
wait 3
# Add a scrollbar
%A = @sendmsg(@winexists(~L1),$0194,400,0)
# Set scrollbar position
%%SB_BOTH = 3
%%SB_CTL = 2
%%SB_HORZ = 0
%%SB_VERT = 1
%%L1 = @strdel(@winexists(~L1),1,1)
loadlib user32.dll
%A = @binary(DWORD,0)
%B = @binary(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@addr("%A"),INT:@addr("%B"))
dialog set,S1," "%%Ret@tab()" "We now have a Scrollbar
wait 3
if %%Ret
%%MinPos = @val(@substr(%A,1,4))
%%MaxPos = @val(@substr(%B,1,4))
# Set scrollbar to the right
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MaxPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Scrollbar is at the right
wait 3
# Set scrollbar to the left
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MinPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Scrollbar is at the left
wait 3
else
warn could not get range of scroll bar.
end
freelib user32
dialog set,S1,
:evloop
wait event
%E = @event()
if %E
goto %E
end
goto evloop
:close
exit
|
It seems that @lib returns a value whether there is a scrollbar or not.
This always returns 1 | Code: | %%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@addr("%A"),INT:@addr("%B"))
|
This always returns 0 | Code: | %%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MaxPos,BOOL:1)
|
And this returns 100 if there is not a scrollbar, and 220 if there is | Code: | %%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MinPos,BOOL:1)
|
None of the above gives an error if there's no scrollbar. _________________ cheers
Dave |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sat Oct 06, 2007 4:41 am Post subject: |
|
|
I noticed the scrolbar moves but the document stays still.
This is still so very neat though  |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sat Oct 06, 2007 5:13 am Post subject: |
|
|
Here what I was wanting to do:
| Code: | #
# I really dont want to change the length of the scrollbar.
# Just need to move it left fast when its far to the right.
#
# Moving it left very slow would be handy but not my first objective.
#
DIALOG CREATE,New Dialog,-1,0,350,240
DIALOG ADD,LIST,L1,20,74,200,144
dialog add,Button,fastleft,180,10,120,24,MOVE FAST TO LEFT
dialog add,Button,slowleft,210,10,120,24,MOVE SLOW TO LEFT
dialog add,Button,fastright,180,218,120,24,MOVE FAST TO RIGHT
dialog disable,slowleft
dialog add,Button,slowright,210,218,120,24,MOVE SLOW TO RIGHT
dialog disable,slowright
DIALOG SHOW
List Add,L1,This is a really very long string to get the scrollbar to show up successfully
%A = @sendmsg(@winexists(~L1),$0194,2000,0)
:evloop
wait event
%E = @event()
If %E
goto %E
End
goto evloop
:fastleftBUTTON
goto evloop
:fastrightBUTTON
# I noticed this does not move the document with the scrollbar...
%%SB_BOTH = 3
%%SB_CTL = 2
%%SB_HORZ = 0
%%SB_VERT = 1
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MaxPos,BOOL:1)
Wait 5
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MinPos,BOOL:1)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:CLOSE
Exit |
As you can see below there is no way to do fast horizontal movements with keyboard shortcuts.
Navigating with Keyboard
You can also move into the document with help of keyboard navigation keys. The keys that are used to move cursor into the document on the screen are referred to as navigation keys. The keys and their functions are:
Arrow Keys is used to move the cursor left, right, up and down into Document Window on the screen.
Page up Key is used to move the cursor one page up of Document Window on the screen.
Page down Key is used to move the cursor one page down of Document Window on the screen.
Home Key is used to move the cursor to cursor to the beginning of the current line.
End Key is used to move the cursor to the end of current line
Ctrl+Home Keys are used to move the cursor to the beginning of document.
Crtl+End Keys are used to move the cursor to the end of Document Window. |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sat Oct 06, 2007 9:03 am Post subject: |
|
|
I've been playing around with Johhny's sample code some more. I added a vertical scrollbar example as well as the horizontal example - as well as positioning the scroll bars at the approximate halfway point.
| Code: | #-----------------------------------------------------------------------------#
# Demo of how to scroll a list box all the way to the right #
# Author: Johnny Kinsey #
# Copyright: Copyright © 2007 DragonSphere Software #
#-----------------------------------------------------------------------------#
DIALOG CREATE,Scrollbar Demo,-1,0,200,180,NOMIN
DIALOG ADD,LIST,L1,8,8,184,144
DIALOG ADD,STATUS,S1,[40]|
dialog SHOW
%c = 1
repeat
list Add,L1,Line %c - This is a long string to get the scrollbar to show up
%c = @succ(%c)
until @greater(%c,20)
dialog set,S1,@tab()" "No Horizontal Scrollbar
wait 4
# Add a horizontal scrollbar
%A = @sendmsg(@winexists(~L1),$0194,400,0)
%%SB_BOTH = 3
%%SB_CTL = 2
%%SB_HORZ = 0
%%SB_VERT = 1
%%L1 = @strdel(@winexists(~L1),1,1)
loadlib user32.dll
%A = @binary(DWORD,0)
%B = @binary(DWORD,0)
# Horizontal scrollbar
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@addr("%A"),INT:@addr("%B"))
dialog set,S1," "%%Ret@tab()" "Horizontal Scrollbar added
wait 4
if %%Ret
%%MinPos = @val(@substr(%A,1,4))
%%MaxPos = @val(@substr(%B,1,4))
%%HHalfPos = 125
# Set Horz scrollbar to the right
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MaxPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Horz Scrollbar is at the right
wait 4
# Set Horz scrollbar half way
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%HHalfPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Horz Scrollbar is in the middle
wait 4
# Set Horz scrollbar to the left
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MinPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Horz Scrollbar is at the left
wait 4
else
warn could not get range of horizontal scroll bar.
end
# Vert scrollbar
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_VERT,INT:@addr("%A"),INT:@addr("%B"))
if %%Ret
%%MinPos = @val(@substr(%A,1,4))
%%MaxPos = @val(@substr(%B,1,4))
%%VHalfPos = 6
# Set Vert scrollbar to the bottom
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_VERT,INT:%%MaxPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Vert Scrollbar is at the bottom
wait 4
# Set Vert scrollbar half way
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_VERT,INT:%%VHalfPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Vert Scrollbar is in the middle
wait 4
# Set Vert scrollbar to the top
%%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_VERT,INT:%%MinPos,BOOL:1)
dialog set,S1," "%%Ret@tab()" "Vert Scrollbar is at the top
wait 4
else
warn could not get range of vertical scroll bar.
end
freelib user32
dialog set,S1,
wait event
exit
|
Which raises a question. Is there an easy way to calculate the halfway position of a scrollbar?
I tried things like "%%HalfPos = @div(%%MaxPos,2)" but it seems like the halfway point for the vertical scrollbar is determined by half the number of visible lines. And the halfway point for the horizontal scrollbar seems to be the width of the scrollbar minus the width of the list, divided by 2. _________________ cheers
Dave
Last edited by DaveR on Sat Oct 06, 2007 11:08 am; edited 1 time in total |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sat Oct 06, 2007 9:28 am Post subject: |
|
|
| Is it half the columns of longest string LEN? |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Oct 06, 2007 2:24 pm Post subject: |
|
|
| Dave® wrote: |
It seems that @lib returns a value whether there is a scrollbar or not.
This always returns 1 | Code: | %%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@addr("%A"),INT:@addr("%B"))
|
This always returns 0 | Code: | %%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MaxPos,BOOL:1)
|
And this returns 100 if there is not a scrollbar, and 220 if there is | Code: | %%Ret = @lib(user32,SetScrollPos,INT,INT:%%L1,INT:%%SB_HORZ,INT:%%MinPos,BOOL:1)
|
None of the above gives an error if there's no scrollbar. |
Just because you don't see a scroll bar does not mean that it does not exist. Any Window or control that has the WS_HSCROLL and WS_VSCROLL has a scrollbar. It is up to the programmer to show it. Most controls already have a scrollbar but they are hidden. There is also a ShowScrollBar Win32 API function that can turn them on and off but the control must have the correct styles applied to their window.
SetScrollPos returns the previous position of the scroll bar. I would say that if the scroll bar is not showing then it would return unpredictable results.
If you really want to dig into all this Win32 API stuff you might want to download the Win32 API help file that is posted in the documentation section here at www.vdsworld.com _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Oct 06, 2007 2:30 pm Post subject: |
|
|
Hmm,
I just did a search for the help file and I don't see it anymore I guess I can upload it again but I don't know why it was taken down. If anyone knows why it was removed please let me know? _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Oct 06, 2007 3:44 pm Post subject: |
|
|
| vtol wrote: | I noticed the scrolbar moves but the document stays still.
This is still so very neat though  |
Unfortunately, I don't have code with me right now but basically when you move the scroll button (programmically) your not actually scrolling.
You need to programmically 'Click' the scroll button after you move it.
When I get home I'll see if I can find the code for it. |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Oct 06, 2007 6:15 pm Post subject: |
|
|
Sorry Vtol & Dave I did not realize that you wanted to scroll the contents too. Below is an example that uses the WM_HSCROLL message to scroll the bar and contents of the Listbox. It actually shows 2 examples using the same message ID.
| Code: |
#-----------------------------------------------------------------------------#
# #
# Demo of how to scroll a list box all the way to the right #
# #
# Author: Johnny Kinsey #
# #
# Copyright: Copyright © 2007 DragonSphere Software #
# #
#-----------------------------------------------------------------------------#
DIALOG CREATE,New Dialog,-1,0,240,204
REM *** Modified by Dialog Designer on 10/6/2007 - 13:14 ***
DIALOG ADD,LIST,L1,8,30,112,144
DIALOG ADD,STATUS,STATUS1,STATUS1
DIALOG SHOW
List Add,L1,This is a long string to get the scrollbar to show up
%A = @sendmsg(@winexists(~L1),$0194,2000,0)
%%SB_BOTH = 3
%%SB_CTL = 2
%%SB_HORZ = 0
%%SB_VERT = 1
%%WM_HSCROLL = 276
%%WM_VSCROLL = 277
%%SB_LINEUP = 0
%%SB_LINEDOWN = 1
%%SB_LINELEFT = 0
%%SB_LINERIGHT = 1
%%SB_PAGEUP = 2
%%SB_PAGEDOWN = 3
%%SB_PAGELEFT = 2
%%SB_PAGERIGHT = 3
%%SB_THUMBPOSITION = 4
%%SB_THUMBTRACK = 5
%%SB_ENDSCROLL = 8
%%SB_LEFT = 6
%%SB_RIGHT = 7
%%SB_BOTTOM = 7
%%SB_TOP = 6
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_RIGHT and SB_LEFT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_RIGHT,0)
Wait 5
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_LEFT,0)
Wait 5
# Example using the SB_THUMBPOSITION scroll code
%U = @binary(WORD,%%SB_THUMBPOSITION)@binary(WORD,%%MaxPos)
%V = @Val(@SubStr(%U,1,4))
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%V,0)
Wait 5
%U = @binary(WORD,%%SB_THUMBPOSITION)@binary(WORD,%%MinPos)
%V = @Val(@SubStr(%U,1,4))
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%V,0)
# Example of paging right and left
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_PAGERIGHT,0)
Wait
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_PAGERIGHT,0)
Wait
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_PAGELEFT,0)
Wait
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_PAGELEFT,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
:evloop
wait event,0.3
%E = @event()
If %E
goto %E
End
goto evloop
:TIMER
%X = @mousepos(X)
%Y = @mousepos(Y)
Dialog Set,STATUS1,Window at is @WINATPOINT(%X,%Y) %X %Y
goto evloop
:CLOSE
Exit
|
Anyway I hope this helps and it sure beats sending keys. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Oct 07, 2007 12:26 am Post subject: |
|
|
WOW - I'm not worthy - but this is galaxys more than I expected - and a lot more work than I figured - I really appreciate this Dragonsphere
Great
| Code: | #-----------------------------------------------------------------------------#
# #
# Demo of how to scroll a list box all the way to the right - and much more.. #
# #
# Author: Johnny Kinsey #
# #
# Copyright: Copyright © 2007 DragonSphere Software #
# #
#-----------------------------------------------------------------------------#
#
# I really dont want to change the length of the scrollbar.
#
# Moving it left very slow would be handy but not my first objective.
#
DIALOG CREATE,Scrollbar Sample,-1,0,350,288
DIALOG ADD,LIST,L1,20,10,170,100
dialog add,Button,thumbvertical,20,218,120,24,ThumbPOS Vertical
dialog add,Button,homeup,68,218,120,24,HOME UP
dialog add,Button,homedown,98,218,120,24,HOME DOWN
dialog add,Button,reset,140,152,46,32,RESET
dialog add,Button,homeleft,160,10,120,24,HOME LEFT
dialog add,Button,slowleft,190,10,120,24,MOVE SLOW TO LEFT
dialog add,Button,homeright,160,218,120,24,HOME RIGHT
dialog disable,slowleft
dialog add,Button,slowright,190,218,120,24,MOVE SLOW TO RIGHT
dialog disable,slowright
dialog add,Button,pageleft,220,10,120,24,Page Left
dialog add,Button,pageright,220,218,120,24,Page Right
dialog add,Button,thumbhorizontal,254,113,120,24,ThumbPOS Horizontal
DIALOG SHOW
List Add,L1,This is a really very long string to get the scrollbar to show up successfully
%c = 0
REPEAT
%c = @SUCC(%c)
List Add,L1,%c
UNTIL @equal(%c,26)
%A = @sendmsg(@winexists(~L1),$0194,2000,0)
:evloop
wait event
%E = @event()
If %E
goto %E
End
goto evloop
:homedownBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_VERT,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_LEFT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_VSCROLL,%%SB_BOTTOM,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:homeupBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_VERT,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_LEFT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_VSCROLL,%%SB_TOP,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:thumbverticalBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_VERT,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
rem INFO @CR()%%MaxPos@CR()%%MinPos
%%MaxPos = 13
# Example using the SB_THUMBPOSITION scroll code
%U = @binary(WORD,%%SB_THUMBPOSITION)@binary(WORD,%%MaxPos)
%V = @Val(@SubStr(%U,1,4))
%z = @SendMsg(@winexists(~L1),%%WM_VSCROLL,%V,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:thumbhorizontalBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
rem INFO @CR()%%MaxPos@CR()%%MinPos
%%MaxPos = 40
# Example using the SB_THUMBPOSITION scroll code
%U = @binary(WORD,%%SB_THUMBPOSITION)@binary(WORD,%%MaxPos)
%V = @Val(@SubStr(%U,1,4))
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%V,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:pagerightBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
# Example of paging right
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_PAGERIGHT,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:pageleftBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
# Example of paging right
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_PAGELEFT,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:homeleftBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_LEFT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_LEFT,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:homerightBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_RIGHT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_RIGHT,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:resetBUTTON
GOSUB var
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_VERT,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_LEFT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_VSCROLL,%%SB_TOP,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
%%L1 = @strdel(@winexists(~L1),1,1)
LoadLib user32.dll
%A = @BINARY(DWORD,0)
%B = @BINARY(DWORD,0)
%%Ret = @lib(user32,GetScrollRange,BOOL,INT:%%L1,INT:%%SB_HORZ,INT:@Addr("%A"),INT:@Addr("%B"))
If %%Ret
%%MinPos = @val(@SubStr(%A,1,4))
%%MaxPos = @val(@SubStr(%B,1,4))
# Example using the SB_LEFT Scroll code
%z = @SendMsg(@winexists(~L1),%%WM_HSCROLL,%%SB_LEFT,0)
Else
Warn could not get range of scroll bar.
End
FreeLib user32
goto evloop
:var
%%SB_BOTH = 3
%%SB_CTL = 2
%%SB_HORZ = 0
%%SB_VERT = 1
%%WM_HSCROLL = 276
%%WM_VSCROLL = 277
%%SB_LINEUP = 0
%%SB_LINEDOWN = 1
%%SB_LINELEFT = 0
%%SB_LINERIGHT = 1
%%SB_PAGEUP = 2
%%SB_PAGEDOWN = 3
%%SB_PAGELEFT = 2
%%SB_PAGERIGHT = 3
%%SB_THUMBPOSITION = 4
%%SB_THUMBTRACK = 5
%%SB_ENDSCROLL = 8
%%SB_LEFT = 6
%%SB_RIGHT = 7
%%SB_BOTTOM = 7
%%SB_TOP = 6
EXIT
:CLOSE
Exit |
I threw this together real quick, a person could change all the ThumbPOS to percentages or chunks.
The MOVE SLOWs could be done with ThumbPOS homemade soft touch button progressions.
Thanks again DragonSphere
 |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sun Oct 07, 2007 7:55 am Post subject: |
|
|
| dragonsphere wrote: | Hmm,
I just did a search for the help file and I don't see it anymore I guess I can upload it again but I don't know why it was taken down. |
That'd be great. Lately I've never been able to find a copy of it (though I'm sure I had a copy years ago)
| dragonsphere wrote: | | Sorry Vtol & Dave I did not realize that you wanted to scroll the contents too. |
Yep, but it's also cool to be able to just move the scroll bar.
| dragonsphere wrote: | | Anyway I hope this helps and it sure beats sending keys. |
Thanks. It works great. It made a nice finishing touch to a program I've been working on. _________________ cheers
Dave |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|