类似功能的参考示例
of = CREATEOBJECT("myForm")
of.show(1)
DEFINE CLASS myForm as Form
ADD OBJECT fList as FileList WITH width=this.Width,height=this.height
ENDDEFINE
DEFINE CLASS FileList as listbox
RowSourceType=7
sPath = ""
sName = ""
PROCEDURE RightClick
IF FILE(this.list(2)+this.value)
myPop(this)
ENDIF
ENDPROC
ENDDEFINE
FUNCTION myPop(oFileList)
DEFINE POPUP pop FROM MROW(),MCOL()
DEFINE BAR 1 OF pop PROMPT "复制"
DEFINE BAR 2 OF pop PROMPT "粘贴"
DEFINE BAR 3 OF pop PROMPT "删除"
ON SELECTION POPUP pop mySelpop(POPUP(), PROMPT(), oFileList)
ACTIVATE POPUP pop
DEACTIVATE POPUP pop
RELEASE POPUP pop
ENDFUNC
FUNCTION mySelpop(cPopup, cPrompt, oFileList)
DO CASE
CASE cPrompt == "复制"
oFileList.sPath = oFileList.list(2)
oFileList.sName = oFileList.value
CASE cPrompt == "粘贴"
IF !FILE(oFileList.sPath+oFileList.sName) OR (oFileList.sPath==oFileList.list(2))
MESSAGEBOX("无效的文件名或路径")
RETURN
ENDIF
COPY FILE (oFileList.sPath+oFileList.sName) TO (oFileList.list(2)+oFileList.sName)
oFileList.Requery
oFileList.sPath = ""
oFileList.sName = ""
CASE cPrompt == "删除"
IF FILE(oFileList.list(2)+oFileList.value)
IF MESSAGEBOX("删除 "+oFileList.value,17,"提示")==1
DELETE FILE (oFileList.list(2)+oFileList.value)
oFileList.Requery
ENDIF
ENDIF
OTHERWISE
ENDCASE
DEACTIVATE POPUP (cPopup)
RELEASE POPUP (cPopup)
ENDFUNC
of = CREATEOBJECT("myForm")
of.show(1)
DEFINE CLASS myForm as Form
ADD OBJECT fList as FileList WITH width=this.Width,height=this.height
ENDDEFINE
DEFINE CLASS FileList as listbox
RowSourceType=7
sPath = ""
sName = ""
PROCEDURE RightClick
IF FILE(this.list(2)+this.value)
myPop(this)
ENDIF
ENDPROC
ENDDEFINE
FUNCTION myPop(oFileList)
DEFINE POPUP pop FROM MROW(),MCOL()
DEFINE BAR 1 OF pop PROMPT "复制"
DEFINE BAR 2 OF pop PROMPT "粘贴"
DEFINE BAR 3 OF pop PROMPT "删除"
ON SELECTION POPUP pop mySelpop(POPUP(), PROMPT(), oFileList)
ACTIVATE POPUP pop
DEACTIVATE POPUP pop
RELEASE POPUP pop
ENDFUNC
FUNCTION mySelpop(cPopup, cPrompt, oFileList)
DO CASE
CASE cPrompt == "复制"
oFileList.sPath = oFileList.list(2)
oFileList.sName = oFileList.value
CASE cPrompt == "粘贴"
IF !FILE(oFileList.sPath+oFileList.sName) OR (oFileList.sPath==oFileList.list(2))
MESSAGEBOX("无效的文件名或路径")
RETURN
ENDIF
COPY FILE (oFileList.sPath+oFileList.sName) TO (oFileList.list(2)+oFileList.sName)
oFileList.Requery
oFileList.sPath = ""
oFileList.sName = ""
CASE cPrompt == "删除"
IF FILE(oFileList.list(2)+oFileList.value)
IF MESSAGEBOX("删除 "+oFileList.value,17,"提示")==1
DELETE FILE (oFileList.list(2)+oFileList.value)
oFileList.Requery
ENDIF
ENDIF
OTHERWISE
ENDCASE
DEACTIVATE POPUP (cPopup)
RELEASE POPUP (cPopup)
ENDFUNC