Treeview with checkbox ?

User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Post by anserkk »

Hakan,

I think you have to modify Class TTreeView at source/classes/treeview.prg as per Mr.Antonio's Instruction in this thread. Please see the Mr.Antonio's first reply in this thread.

Regards

Anser
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Hakan,

yes, some changes are required.

We are still testing them.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Post by Horizon »

Thanks anser,

I have the latest version of FWH. I thought changes that you mentioned included the 8.10.
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Hakan,

We have added a new clause ... TREEVIEW ... CHECKBOX and also some new methods in Class TTVItem, but we are still testing them.

If you want to test them, we can provide you the changes.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Post by Horizon »

Antonio,

I can wait it.

Thanks,
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
goosfancito
Posts: 1392
Joined: Fri Oct 07, 2005 7:08 pm

Post by goosfancito »

Antonio. Gracias.

Lo que me esta complicando es el tema de recorrer y luego setear algunos checkbox como marcados y otros como no.

Gracias.
Antonio Linares wrote:Gustavo,

test.prg

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg, oTree 

   DEFINE DIALOG oDlg

   @ 0, 0 TREEVIEW oTree OF oDlg SIZE 200, 200 CHECKBOXES

   ACTIVATE DIALOG oDlg CENTERED ON INIT definirTree( oTree ) 

   MsgInfo( oTree:GetCheck( oTree:aItems[ 1 ] ) ) 

return nil 

function definirTree(oTree) 

   local oMenu    := array(3), ; 
         oSubMenu := array(10) 

   oMenu[1]:= oTree:Add( "Principal" ) 
      oSubMenu[1]:= oMenu[1]:Add( "Imprimir..." ) 

   oMenu[2]:= oTree:Add( "Proyectos" ) 
      oSubMenu[6]:= oMenu[2]:Add( "Definir Proyectos" ) 
      oSubmenu[7]:= oMenu[2]:Add( "Actualización datos" ) 

   oTree:expand() 

return nil 
Image
Un aporte chico hace grandes cambios.
Apoyemos al proyecto "Hogar pimpinela"
Bajate la aplicación (gratuita) y encuentra en ella toda la info de como podes colaborar.
GRACIAS!
https://play.google.com/store/apps/deta ... .acomprar
User avatar
goosfancito
Posts: 1392
Joined: Fri Oct 07, 2005 7:08 pm

Post by goosfancito »

Antonio, Seria mucho pedirte que me enviaras el exe de este ejemplo? porque aca en mi pc cuando selecciono el item principal, las subramas no se seleccionan. O sea, oMenu[2]:= oTree:Add( "Proyectos" ) al seleccionar el checkbox que esta en "proyectos" los item contenidos en este no se seleccionan.

Podrias enviarme el .exe?

Gracias.
Antonio Linares wrote:Gustavo,

test.prg

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg, oTree 

   DEFINE DIALOG oDlg

   @ 0, 0 TREEVIEW oTree OF oDlg SIZE 200, 200 CHECKBOXES

   ACTIVATE DIALOG oDlg CENTERED ON INIT definirTree( oTree ) 

   MsgInfo( oTree:GetCheck( oTree:aItems[ 1 ] ) ) 

return nil 

function definirTree(oTree) 

   local oMenu    := array(3), ; 
         oSubMenu := array(10) 

   oMenu[1]:= oTree:Add( "Principal" ) 
      oSubMenu[1]:= oMenu[1]:Add( "Imprimir..." ) 

   oMenu[2]:= oTree:Add( "Proyectos" ) 
      oSubMenu[6]:= oMenu[2]:Add( "Definir Proyectos" ) 
      oSubmenu[7]:= oMenu[2]:Add( "Actualización datos" ) 

   oTree:expand() 

return nil 
Image
Un aporte chico hace grandes cambios.
Apoyemos al proyecto "Hogar pimpinela"
Bajate la aplicación (gratuita) y encuentra en ella toda la info de como podes colaborar.
GRACIAS!
https://play.google.com/store/apps/deta ... .acomprar
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Friends,

I have looked this topic...
I got it put in the correct format, with checkboxes... really, it's very simple...

How I can change the treeview for this:
Image
At all node, when it's a root node, in this item I want to not display the checkboxes... like the image! The checkboxes only in sub-items of all items of treeview.
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Júlio,

Will you show us how you did it?

Regards,
James
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Gustavo,

Cuando el checkbox "padre" es seleccionado, los checkboxes de las ramas hijas no se seleccionan automaticamente. Eso hay que hacerlo via programación.

When the parent checkbox is set, the childs checkboxes are not set automatically. You have to code such behavior.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

James Bott wrote:Júlio,

Will you show us how you did it?

Regards,
James
James,

This is that I want ;)



Antonio, it's possible?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
goosfancito
Posts: 1392
Joined: Fri Oct 07, 2005 7:08 pm

Post by goosfancito »

A ok.
Pienso que deberia de seleccionarse automaticamente, sino de que valdria tenerlo...

Gracias.
Antonio Linares wrote:Gustavo,

Cuando el checkbox "padre" es seleccionado, los checkboxes de las ramas hijas no se seleccionan automaticamente. Eso hay que hacerlo via programación.

When the parent checkbox is set, the childs checkboxes are not set automatically. You have to code such behavior.
Un aporte chico hace grandes cambios.
Apoyemos al proyecto "Hogar pimpinela"
Bajate la aplicación (gratuita) y encuentra en ella toda la info de como podes colaborar.
GRACIAS!
https://play.google.com/store/apps/deta ... .acomprar
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

So friends,

About my question? It's not possible?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Gustavo,

It seems as Windows API doesn't do it automatically, so we have to code it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Gustavo,

This procedure can do it!

Code: Select all

PROCEDURE checkTreeView( oItemTree, lComplete, lCheckComplete )

LOCAL oObjTree, oObjItem

LOCAL nPos := 0

DEFAULT lComplete      := NIL, ;
        lCheckComplete := NIL



oObjTree := iif( valType( oItemTree ) == "O" .AND. upper( oItemTree:className() ) == "TTREEVIEW", oItemTree, oItemTree:oTree )

IF !isNull( lComplete )

   FOR nPos := 1 TO len( oObjTree:aItems )

       oObjItem := oObjTree:aItems[nPos]

       IF !isEmpty( oObjItem:aItems )
          checkTreeView( oObjItem,, lComplete )
       ELSE
          oObjTree:setCheck( oObjItem, lComplete )
       ENDIF

   NEXT

ELSE

   oObjTree:setCheck( oItemTree, iif( !isNull( lCheckComplete ), lCheckComplete, !oObjTree:getCheck( oItemTree ) ) )

   FOR nPos := 1 TO len( oItemTree:aItems )

       oObjItem := oItemTree:aItems[nPos]

       IF !isEmpty( oObjItem:aItems )
          checkTreeView( oObjItem,, lCheckComplete )
       ELSE
          oObjTree:setCheck( oObjItem, iif( !isNull( lCheckComplete ), lCheckComplete, !oObjTree:getCheck( oObjItem ) ) )
       ENDIF

   NEXT

ENDIF

RETURN( NIL )
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Post Reply