Lars Erdmann schrieb:
Am 14.09.15 20.11, schrieb Andi B.:
Hi,
how to get the current scroll position from a container?
I can get the current selected object with -
psrec = WinSendDlgItemMsg( hwnd, ulCnrId,
CM_QUERYRECORDEMPHASIS,
MPFROMLONG( CMA_FIRST),
MPFROMLONG( CRA_SELECTED));
but how can I query the scroll position (and set it again afterwards
when I filled it with refreshed objects)?
Thanks, Andi
The container control has a bunch of atomic children like the 2
scrollbars for horizontal and vertical scroll.
I think you will have to manipulate these:
hwndCnr = WinWindowFromID(hwnd,ulCnrId);
// the CID_ constants are the ids of all the children controls
hwndVertScroll = WinWindowFromID(hwndCnr,CID_VSCROLL);
// save old vertical scroll position
SHORT oldYPos = SHORT1FROMMR(WinSendWindowMsg(hwndVertScroll,SBM_QUERYPOS,MPVOID,MPVOID));
... do you stuff ...
// restore old vertical scroll position WinSendWindowMsg(hwndVertScroll,SBM_SETPOS,MPFROMSHORT(oldYPos),MPVOID);
I hope that that'll do.
Lars
Ok you pointed me in the right direction. Reading scroll position works
as you suggested. For setting back the container afterwards to the
original position I have to use -
// restore old vertical scroll position
WinSendDlgItemMsg( hwnd, ulCnrId,
CM_SCROLLWINDOW,
MPFROMSHORT( CMA_VERTICAL ),
MPFROMSHORT( oldYPos ));
Your code (slightly modified to WinSendMsg instead WinSendWindowMsg)
moves the slider only but not the content. Just in case anyone finds
these thread some times.
Thanks.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)