#code=950T936
ENVI^ EnviMode=1
ENVI^ ForceLocal=1
SET  ::WM_REFLECT_BASE=0xBC00
SET  ::WM_HSCROLL=0x0114
SET  ::WM_VSCROLL=0x0115
CALC -base=16 &::WM_HSCROLL_REFLECT=%WM_HSCROLL% + %WM_REFLECT_BASE%
CALC -base=16 &::WM_VSCROLL_REFLECT=%WM_VSCROLL% + %WM_REFLECT_BASE%

CALL @Win1
 
_SUB Win1,W347H455,PECMD ScrollBar 演示,,"."#4,,,  //-disminb  //-maxb
    ITEM ITEM1,L58T348W60H30,TEST, OnTEST
    ITEM ITEM2,L128T348W60H30,查询, OnQ
    SBAR -color:0xFF   SBARH,L0T400W328H15,0:100:00:20,,0x40
    SBAR -color:0xFF00 SBARV,L322T0W15H400,0:100:00:20,,
    //ENVI @this.MSG=_%WM_HSCROLL%::&&wp,&&lp, OnScroll %&wp% %&lp% SBARH  //注册到主窗口
    //ENVI @this.MSG=_%WM_VSCROLL%::&&wp,&&lp, OnScroll %&wp% %&lp% SBARV
    ENVI @SBARH.MSG=_%WM_HSCROLL_REFLECT%::&&wp,&&lp, OnScroll %&wp% %&lp% SBARH  //注册到控件本身窗口
    ENVI @SBARV.MSG=_%WM_VSCROLL_REFLECT%::&&wp,&&lp, OnScroll %&wp% %&lp% SBARV
_END

_SUB  OnScroll //%wp% %lp% Name
    ENVI @%~3.VAL=?&nCur:&&from:&&to:&&npage
    ENVI @this= %3 [%nCur%]  [%from%]  [%to%]  [%npage%]
_END


_SUB  OnQ
    ENVI  @SBARH.VAL=?&nCur:&&from:&&to:&&npage
    MESS 查询 [%nCur%]  [%from%]  [%to%]  [%npage%]
_END

_SUB  OnTEST,*
    CALC #nCur=%nCur%+13
    ^IFEX #%nCur%>100, CALC #nCur=%nCur%  % 13
    ENVI  @SBARH.VAL=%nCur%
    MESS=-p:%RWID%   111
_END

