oTree para video FUNCIONANDO
Posted: Fri Dec 15, 2017 10:58 pm
Confieso no tener ni idea de como tratar los objetos Tree, nunca los he necesitado, pero he cogido un ejemplo del foro y es lo que estoy buscando para poder ver, añadir, borrar ficheros de video a mi aplicación. A ver si me podeis echar una mano en como seleccionar un fichero de los que muestra el tree.
Cómo puedo seleccionar el fichero que muestra y tengo seleccionado en el tree, he intentado algo como lo siguiente, pero no me da el correcto con el boton Ver:
Code: Select all
#include "FiveWin.ch"
function Main()
Video(".\DAT\VID\"+"DOC000003"+".*")
Return nil
function Video()
parameters x_file, x_msg
local oDlg, oTree
DEFAULT x_msg := "Fichero no localizado..."
DEFINE DIALOG oDlg SIZE 500, 340 TITLE "Archivos de video relacionados"
@ 0.5, 1 TREEVIEW oTree OF oDlg SIZE 100, 150
@ 1, 27 BUTTON "&Ver" OF oDlg SIZE 40, 12 ;
ACTION (msginfo(oTree:GetSelected():cPrompt) , oDlg:End()) DEFAULT //(WinExec("CMD /C START /separate " + x_file,0)
@ 3, 27 BUTTON "&Añadir " OF oDlg SIZE 40, 12 ;
ACTION (CopyFile(cGetFile("*.mp4;*.mov;*.avi;*.mkv;*.flv;*.swf;*.m4v" ,"Selecciona fichero", , ".."), x_file ), oDlg:End())
@ 5, 27 BUTTON "&Borrar " OF oDlg SIZE 40, 12 ;
ACTION oDlg:End() DEFAULT
@ 7, 27 BUTTON "&Abandonar" OF oDlg SIZE 40, 12 ;
ACTION ( cValue := nil, oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT FillTree( oTree, x_file )
return nil
function FillTree( oTree, cPath, oItem )
local aInfo := Directory( cPath, "D" )
local n, oNode
xbrowse (aInfo)
for n = 1 to Len( aInfo )
if ! aInfo[ n ][ 1 ] $ ".,.."
if oItem == nil
oNode = oTree:Add( aInfo[ n ][ 1 ] )
else
oNode = oItem:Add( aInfo[ n ][ 1 ] )
endif
if "D" $ aInfo[ n ][ 5 ]
FillTree( oTree, cPath + aInfo[ n ][ 1 ] + "\", oNode )
endif
endif
next
return nil
msginfo(oTree:GetSelected():cPrompt)