I was making an update to my last remaining program that uses IFLOGM for dialogs rather than the Windows SDK. Consider the small routine below which gets the handle for a list box on a modeless dialog, gets the min / max range of the vertical scroll bar and then sets the current position to the max position such that you can see the info that has been put there.
This works fine in that the 'get' returns the correct values, and 'set' returns with the correct position before the update, however irrespective of where the slider thumb was or has been set to the dialog is always then displayed with the thumb moved to position zero. IE my set has no effect.
Is my code wrong? Is it just a 'feature' of the IFLOGM implementation of dialogs? Is there a simple alternative method?
Any ideas would be appreciated. Best Regards, Andrew
subroutine update_scroll_pos() use :: ifwin, only: bool, LPINT, GetScrollRange, TRUE, SetScrollPos, & SB_VERT, SINT, GetDlgItem, handle, SB_CTL use :: dku, only: gdlg, IDC_LIST_MESG use, intrinsic :: iso_c_binding, only: c_loc implicit none integer(handle) :: Hwnd integer(bool) :: bret integer :: ipmin, ipmax integer(SINT) :: ipos hwnd = GetDlgItem(gdlg%hwnd,IDC_LIST_MESG) bret = GetScrollRange( Hwnd, SB_VERT, & transfer(C_loc(ipmin),hwnd),& transfer(C_loc(ipmax),hwnd) ) if(bret /= 0) ipos = SetScrollPos( Hwnd, SB_VERT, int(ipmax, sint) , TRUE ) end subroutine update_scroll_pos