#!PECMD
IFEX %&CurFile%.LOG, LOGS --2 * %&CurFile%.LOG
SET$ &TAB=09
SET$ &NL=0D 0A
SET &::WM_RBUTTONDOWN=0x0204
CALC #&LVM_ENSUREVISIBLE=(0x1000 + 19)


CALL @WinTEST
EXIT FILE

_SUB WinTEST,W570H340,新窗口1,
	TABL PartTABL,L9T10W545H109,65:TABL1%&TAB%370:TABL2%&TAB%90:TABL3,1%&TAB%AAAAAAAAAA%&NL%2%&TAB%AAAAAAAAAA%&NL%3%&TAB%AAAAAAAAAA%&NL%4%&TAB%AAAAAAAAAA
	\%&NL%5%&TAB%AAAAAAAAAA%&NL%6%&TAB%AAAAAAAAAA%&NL%7%&TAB%AAAAAAAAAA%&NL%8%&TAB%AAAAAAAAAA
	\%&NL%9%&TAB%AAAAAAAAAA%&NL%10%&TAB%AAAAAAAAAA%&NL%11%&TAB%AAAAAAAAAA%&NL%12%&TAB%AAAAAAAAAA
	\%&NL%13%&TAB%AAAAAAAAAA%&NL%14%&TAB%AAAAAAAAAA%&NL%15%&TAB%AAAAAAAAAA%&NL%16%&TAB%AAAAAAAAAA,0x10040
	
	LABE -left -vcenter Status,L10T273W250H22,这里是状态栏，您需要的信息将会在这显示...,,0xBF0000
	
	ITEM SEL01,L264T270W68H28,SEL=1,CALL SCROLL 1,,
	ITEM SEL10,L338T270W68H28,SEL=10,CALL SCROLL 10,,
	
	ITEM DOIT_1,L412T270W68H28,Enable=1,TEAM ENVI @PartTABL.enable=1| ENVI @Status.enable=1,,
	ITEM DOIT_0,L486T270W68H28,Enable=0,TEAM ENVI @PartTABL.enable=0| ENVI @Status.enable=0,,
	
	ENVI @PartTABL.sel=14
	ENVI @PartTABL.SENDMSG=%&LVM_ENSUREVISIBLE%;14;0

    SET &iSelMenu=4
	
	ENVI @PartTABL.MSG=_%&WM_RBUTTONDOWN%: CALL @--popmenu ContextMenu	//弹出右键菜单
_END

_SUB SCROLL  //ShowLn [SelIn]
	@FIND $%~2<>, ENVI @PartTABL.sel=%~2
	ENVI @PartTABL.sel=%~1
	^CALC #&N=%~1-1
	ENVI @PartTABL.SENDMSG=%&LVM_ENSUREVISIBLE%;%&N%;0
_END

_SUB ContextMenu	//%1是父控件的名称
    IFEX #%&iSelMenu%=4, SET &v4=4! SET &v4=0 
    IFEX #%&iSelMenu%=3, SET &v3=4! SET &v3=0 
    IFEX #%&iSelMenu%=2, SET &v2=4! SET &v2=0 
	MENU ,选择:,,-		//创建被禁用的菜单项作为标题
	MENU -
	MENU ,/s /v /qb, CALL PopMenuSet 2 "2222"  %1,%&v2%
	MENU -
	MENU ,/quiet /norestart, CALL PopMenuSet 3 "333" %1,%&v3%
	MENU -
	MENU ,/silent /norestart, CALL PopMenuSet 4 "44444" %1,%&v4%
_END

_SUB PopMenuSet  // itSelf "XXX XXX" XXX  id
    IFEX #%iSelMenu%=%~1, 
    {*  SET iSelMenu=-1
        MESS* [%&__MemuId%][%&__MenuInx%] 取消了  %~1@DEBUG
    }!
    {*  
        IFEX #%&iSelMenu%>=0, SET &vMsg=前面的%&iSelMenu%自动去掉了。! SET &vMsg=
        SET iSelMenu=%~1
        MESS* [%&__MemuId%][%&__MenuInx%] 选择了 %~1。 %&&vMsg%@DEBUG
    }
_END
