Tree (SOLUCIONADO)

Tree (SOLUCIONADO)

Postby Bayron » Sun Feb 20, 2011 1:23 am

Como puedo saber que numero de Item de un Tree se encuentra seleccionado?

Por medio de este codigo:
Code: Select all  Expand view
  oTree:bChanged := {|oTree,oItem| ;
      oItem := oTree:GetSelected(), ;
      If( oItem # nil .and. ValType( oItem:cargo ) == "B", Eval( oItem:cargo ), nil ) }
 

ejecuto una accion cuando el Item es seleccionado, pero yo quisiera que se evaluara solo si se ejecutó un click o un Enter.
Lo del numero de Item lo necesito, debido a que cuando el focus regresa al Tree, no se puede ejecutar nuevamente la accion que se encuentra en el cargo sin mover el seleccionador a otro Item, por lo necesito moverlo un Item atras o adelante y devolverlo a su posicion original; ahora solo puedo moverlo al primer Item usando oTree:GoTop()
Last edited by Bayron on Mon Feb 21, 2011 12:20 am, edited 1 time in total.
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Tree

Postby Daniel Garcia-Gil » Sun Feb 20, 2011 2:14 am

Saludos

prueba este ejemplo

http://forums.fivetechsupport.com/viewtopic.php?p=108203#p108203

esos cambios estan añadidos a la version actual de fivewin.. verifica si eso te sirve
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Tree

Postby Bayron » Sun Feb 20, 2011 2:55 am

Gracias Daniel,
El archivo EXE funciona, pero las modificaciones a la clase no.... el camino esta marcado, voy a revisar a ver donde esta el problema.....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Tree

Postby Bayron » Sun Feb 20, 2011 3:00 am

Daniel, al parecer oParent nunca recive ningun valor...

Cual deberia ser su valor?????
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Tree

Postby Daniel Garcia-Gil » Sun Feb 20, 2011 3:06 am

Bayron

Que error obtienes?

esos fueron los cambios que se le hizo a la clase...
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Tree

Postby Bayron » Sun Feb 20, 2011 3:09 am

Daniel, Ningun error, pero siempre retorna 0 no importando la posicion del Item...
Haciendo pruebas, ::oParent siempre es NIL
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Tree

Postby Daniel Garcia-Gil » Sun Feb 20, 2011 3:21 am

Bayron

probando con el mismo ejemplo expuesto en el post?
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Tree

Postby Bayron » Sun Feb 20, 2011 3:24 am

Si asi es....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Tree

Postby Daniel Garcia-Gil » Sun Feb 20, 2011 3:29 am

Bayron...

posiblemente algo mal hiciste en la modificacion de la clase, o no estas enlazando correctamente el archivo con las modificaciones... no se que mas decirte si no puedo reproducir el error para ayudarte
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Tree

Postby Bayron » Sun Feb 20, 2011 3:38 am

Seguramente asi es, pero no deveria el METHOD ADD de TTreeView enviar algun parametro a TTVitem????

Code: Select all  Expand view
  oItem := TTVItem():New( TVInsertItem( ::hWnd, cPrompt,, nImage, nValue ), Self )
 


No se mucho de clases, pero no veo donde oParent reciba algun valor.....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Tree

Postby Daniel Garcia-Gil » Sun Feb 20, 2011 4:00 am

Bayron

Mira el punto 3 del los cambios

viewtopic.php?p=108203#p108203
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Tree

Postby Bayron » Sun Feb 20, 2011 4:58 am

Gracias Daniel por tu ayuda, pero no funcionó.

::oParent recibe el valor de oParent, el cual es NIL ya que no se le ha otorgado ningun valor todavia...(Creo Yo)

De cualquier manera, ya encontré la forma de hacer lo que quería, y era devolviendo el Foco al Tree con oTree:SetFocus().

Ahora, ya puedo posicionarme en el Tree ya sea con el Mouse o el Teclado, y el :Cargo solo se evalua al presionar ENTER o DOBLE CLICK del mouse:
Code: Select all  Expand view
oTree:bKeyDown = { | nKey, nFlags | KeyDown(nKey, nFlags, oTree, .F. ) }
oTree:blDblClick := { | nKey, nFlags | KeyDown(nKey, nFlags, oTree, .T. ) }
 

Code: Select all  Expand view
function KeyDown(nKey, nFlags, oTree, dClick)

    local oItem := oTree:GetSelected()

    IF nKey = VK_RETURN .OR. dClick
       If( oItem # nil .and. ValType( oItem:cargo ) == "B", Eval( oItem:cargo ), nil )
       oTree:SetFocus()
       
    ENDIF
   
RETURN 
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests