- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a Quickwin command to reset the scroll bar to the top?
Below is a short bit of code for a Fortran program that demonstrates the issue I am having.
If you click back and forth between the Sub1 and Sub2 menu items, the text displays fine because it doesn't exceed the size of the window and the scroll bar doesn't move. However, if you click on Sub3, the scroll bar moves down because the text list is longer than the window size. If you then click on Sub1 or Sub2, the screen is blank because the scroll bar does not reset to the top. You can manually move the scroll bar up to see the text. What I would like to find is a Quickwin command that will reset the scroll bar back to the top automatically without having to do it manually. Does one exist?
use ifqwin
i4status=waitonmouseevent(MOUSE$LBUTTONDBLCLK,im,ix,iy)
end
logical(4) function InitialSettings()
use ifqwin
LOGICAL(4) logstatus
EXTERNAL sub1,sub2,sub3
logstatus =appendmenuqq(1,$menuenabled,'Sub1'C,sub1)
logstatus =appendmenuqq(2,$menuenabled,'Sub2'C,sub2)
logstatus =appendmenuqq(3,$menuenabled,'Sub3'C,sub3)
logstatus =appendmenuqq(4,$menuenabled,'Exit'C,WINEXIT)
initialSettings = logstatus
return
end
subroutine sub1
use ifqwin
call clearscreen($gclearscreen)
write(*,'("Sub1 Line ",i3)') (m,m=1,10)
return
end
subroutine sub2
use ifqwin
call clearscreen($gclearscreen)
write(*,'("Sub2 Line ",i3)') (m,m=1,20)
return
end
subroutine sub3
use ifqwin
call clearscreen($gclearscreen)
write(*,'("Sub3 Line ",i3)') (m,m=1,50)
return
end
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See if SCROLLTEXTWINDOW will do what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
module subroutine cc_ResetScrollPosition(win_handle) !puts vert scroll bar to bottom of window. app 21-jan-2006 USE IFWIN, ONLY : handle, T_SCROLLINFO, UINT_PTR, GetScrollInfo, SB_THUMBPOSITION, SendMessage,& SIF_ALL, SB_VERT, WM_VSCROLL use, intrinsic :: ISO_C_BINDING, only: C_SIZEOF implicit none integer(handle), intent(in) :: win_handle type (T_SCROLLINFO) :: si integer :: status integer(UINT_PTR) :: newPos si%Size = c_sizeof(si) si%Mask = SIF_ALL status = GetScrollInfo(win_handle,SB_VERT,si) newPos = ishft(si%Max,16) !pos in pixels not lines and in upper 2 bytes of npos newpos = newpos + SB_THUMBPOSITION !think thumb pos is where top of scroll is on screen status = SendMessage(win_handle,WM_VSCROLL,int(newPos,fwparam),0_flparam) !send data to windows !status = GetScrollInfo(win_handle,SB_VERT,si) end Subroutine cc_ResetScrollPosition
I found this in my toolbox. There is a quickwin function to return the handle of the window. I also noted that I don't seem to use this so I can't verify works but i expect it does otherwise it would not be in my toolbox.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, the SCROLLTEXTWINDOW does not do what I want. It doesn't move the scroll bar; it just scrolls the text window. For example, SCROLLTEXTWINDOW (int2(-5)) inserts 5 blank lines at the beginning and move the rest of the lines down; SCROLLTEXTWINDOW (int2(5)) simply scrolls the first 5 lines up, essentially deleting the lines from the window. Neither one moves the scroll bar.
Andrew, I couldn't get the subroutine you provided to compile as a Quickwin applicaton without errors, and I don't understand the associated error messages enough to debug it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
QuickWin hasn't had any new development in over a decade, and I don't expect to see any in the future. It is fine within its limits, but it does have limits. The Windows API isn't hard to use from Fortran and there are a number of worked examples in the Samples Bundle. As an alternative look at Xeffort. It too is not being developed, but it has capabilities beyond QuickWin. There are also commercial products such as GINOMENU and WINTERACTER.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
subroutine ccc_ResetScrollPosition(win_handle) !puts vert scroll bar to bottom of window. app 21-jan-2006 USE IFWIN, ONLY : handle, T_SCROLLINFO, UINT_PTR, GetScrollInfo, SB_THUMBPOSITION, SendMessage,& SIF_ALL, SB_VERT, WM_VSCROLL, FWPARAM, FLPARAM use, intrinsic :: ISO_C_BINDING, only: C_SIZEOF implicit none integer(handle), intent(in) :: win_handle type (T_SCROLLINFO) :: si integer :: status integer(UINT_PTR) :: newPos si%Size = c_sizeof(si) si%Mask = SIF_ALL status = GetScrollInfo(win_handle,SB_VERT,si) newPos = ishft(si%Max,16) !pos in pixels not lines and in upper 2 bytes of npos newpos = newpos + SB_THUMBPOSITION !think thumb pos is where top of scroll is on screen status = SendMessage(win_handle,WM_VSCROLL,int(newPos,fwparam),0_flparam) !send data to windows !status = GetScrollInfo(win_handle,SB_VERT,si) end Subroutine ccc_ResetScrollPosition
It was pulled from a submodule and FWPARAM, FLPARAM must have been declared at module level. The one above compiles OK. AI abandoned Quickwin some years back for the windows API. Using the API is 'easy' but with all things it is only easy when you have learned the basics and got past the wall of basic knowledge of how a windows application works.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page