Solo una sugerencia o petición.
Cuando hacemos Doble click sobre la opción elegida enviamos a una funcion con un DO CASE, cuya longitud de opciones sera casi igual de grande que el TREE. Es más, si se intenta añadir una nueva opción a mitad del TREE.., hay que cambiar el DO CASE.
He estado mirando los fuentes y se me escapa el uso de la variable _HMG_SYSDATA [ 307 ], pero estaria bien que en la definicion del TREEITEM se puedese añadir una acción opcional, una ultima opción al ARRAY.
Code: Select all
#xcommand TREEITEM <text> [ IMAGES <aImage> ] [ ID <id> ] [ACTION <accion>] ;
=> ;
_DefineTreeItem (<text>, <aImage> , <id>, <accion> )
Code: Select all
*------------------------------------------------------------------------------*
Function _DefineTreeNode ( text, aImage , nID, accion )
*------------------------------------------------------------------------------*
Local ImgDef, iUnSel, iSel
LOCAL k := GetControlIndexByHandle ( _HMG_SYSDATA [ 180 ] )
DEFAULT accion:=""
If ValType ( nID ) == 'U'
nID := 0
EndIf
ImgDef := iif( valtype( aImage ) == "A" , HMG_LEN( aImage ), 0 ) //Tree+
if ImgDef == 0
iUnsel := 0 // Index to defalut Node Bitmaps, no Bitmap loaded
iSel := 1
else
iUnSel := AddTreeViewBitmap( _HMG_SYSDATA [ 180 ], aImage[1], _HMG_SYSDATA [ 39 ] [k] ) -1
iSel := iif( ImgDef == 1, iUnSel, AddTreeViewBitmap( _HMG_SYSDATA [ 180 ], aImage[2], _HMG_SYSDATA [ 39 ] [k] ) -1 )
// If only one bitmap in array iSel = iUnsel, only one Bitmap loaded
endif
_HMG_SYSDATA [ 307 ]++
// ----------------------------------------------------------------------------------------------
// --> Aqui es donde me pierdo., pero lo suyo seria añadir el valor "accion" a ARRAY
// -----------------------------------------------------------------------------------------------
_HMG_SYSDATA [ 337 ] [_HMG_SYSDATA [ 307 ]]:= AddTreeItem ( _HMG_SYSDATA [ 180 ] , _HMG_SYSDATA [ 337 ] [_HMG_SYSDATA [ 307 ]-1] , text, iUnsel, iSel , nID , _IS_TREE_NODE_ )
aAdd ( _HMG_SYSDATA [ 138 ] , _HMG_SYSDATA [ 337 ] [_HMG_SYSDATA [ 307 ]] )
aAdd ( _HMG_SYSDATA [ 139 ] , nID )
AADD ( _HMG_SYSDATA [ 32 ] [ _HMG_SYSDATA [ 179 ] ], NIL) // cargo
Return Nil
Code: Select all
DEFINE TREE Tree_1 AT 95,10 WIDTH 210 HEIGHT 580 VALUE 1 ;
ON DBLCLICK Ejecuta(This.Value)
-----
FUNCION Ejecuta(nPrg)
//-> Aquí detectariamos si tiene algo el último parametro "accion"
// --> Tengo el nombre, pero necesito identificar el siguiente campo
cAction:=Principal.Tree_1.Item ( Principal.Tree_1.Value ) ,???
IF!empty(cAction)
&cAction // --> EJECUTAMOS LO QUE TENEMOS PREDEFINIDO
ENDIF
// --> Nos ahorramos todos los DOCASE, si bien el usuario y si cAction esta vacio puede hacer lo que quiera con ELSE
DO CASE
CASE nPrg=2
_CONMAEM()
CASE nPrg=3
_TRAMAUS()
CASE nPrg=6
_CONMACO()
CASE nPrg=7
_CONMACU()
CASE nPrg=8
_CONMAAS()
CASE nPrg=9
_CONMATE(0)
ENDCASE
RETURN
Salud