Jeff,
Thank you for providing an example of the implementation of a scroll-bar.
This example was very helpful and clarified the passing of a variable in the createscrollbar() subroutine.
It was not obvious to me that passing a subroutine 'scrolled' as a parameter did not have to itself contain the passed parameter 'p'.
scrollbar = createscrollbar(185, 0, 15, 500, SCROLL_VERTICAL, scrolled)
As in,
contains
subroutine scrolled(p)
implicit none
integer::p,i,j
scroll_position = p
call stopidle()
end subroutine scrolled
A word of caution. I tried moving the inner text display Do-Loop of the Do While()-End Do that displays the scrolled text to the subroutine scrolled(p) instead and it did not work as you would expect. Jeff's approach is the correct one.
!-- Incorrect implementation
subroutine scrolled(p)
implicit none
integer::p,i,j
scroll_position = p
call stopidle()
j = 0
do i = 5, 480, 25
scroll_position = getscrollposition (scrollbar)
Write(text, '(I4)') scroll_position+j
call outtextxy(10, i, text)
j = j + 1
end do
end subroutine scrolled
Thanks again,
Frank