SET  ::WM_LBUTTONDOWN                  =0x0201

ENVI$ NL=0d 0a
ENVI$ TAB=09

//函数名：SelDirFiles
//参数: 返回结果变量名    文件模板
_SUB SelDirFiles,W320H470,选择目录和文件,
    ENVI &&SELSRC=%2  //文件
    ENVI &&_SELDFS=%1  //选择结果变量名
    ENVI %&_SELDFS%=
    ENVI &&FS=

    FORX @%&SELSRC%,&&F,0, ENVI &FS=%&FS%%NL%%&F%%TAB%目录
    FORX %&SELSRC%,&&F,0, ENVI &FS=%&FS%%NL%%&F%
    TABL  -color:###0xFF0000 TABL1,L3T4W303H379,*225:文件%TAB%60,%&FS%, 0x180840  

    ITEM OK1,L123T398W60H30,确认,CALL OnOK,
    ENVI @TABL1.Val=?*;&LINES;&&COLS

    ENVI @TABL1.MSG=%&WM_LBUTTONDOWN%:      CALL  OnLButton
_END
_SUB OnLButton
     TEAM ENVI  @TABL1.Sel=?.&&Row;&&Col|  ENVI  @TABL1.Check=%&Row%;2
_END

_SUB OnOK
    ENVI &&FS=
    ENVI  &&I=1
    LOOP #%&I% <=  %&LINES%, 
    {
        ENVI @TABL1.Check=?%&I%;&&CK
        IFEX $ 1 = %&CK%,
        {
            ENVI @TABL1.Val=?%&I%.1;&&V1
            ENVI &FS=%&FS%%NL%%&V1%
        }
        CALC #&I= %&I% + 1
    } 
    MSTR %&_SELDFS%=3,0,%&FS%
    ENVI~ &&V2=%&_SELDFS%
    KILL \
_END

//测试，单独运行是才有效
//FIND $ 1 = %&&__MAIN__%,
{
    ENVI &&SELDFS=  
    CALL  @SelDirFiles  &SELDFS   C:\*.*
    MESS. 【%&SELDFS%】 @选择结果 #OK  
} 

