FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Treeview with checkbox ?
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 08:05 AM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 08:16 AM

Hakan,

yes, some changes are required.

We are still testing them.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 08:18 AM

Thanks anser,

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

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 08:21 AM

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
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 08:55 AM

Antonio,

I can wait it.

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 04:44 PM
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
#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

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Treeview with checkbox ?
Posted: Fri Oct 24, 2008 10:28 PM
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
#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

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Treeview with checkbox ?
Posted: Fri Oct 24, 2008 11:03 PM
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:

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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Treeview with checkbox ?
Posted: Sat Oct 25, 2008 12:12 AM

Júlio,

Will you show us how you did it?

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Sat Oct 25, 2008 10:12 AM

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
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Treeview with checkbox ?
Posted: Sat Oct 25, 2008 12:41 PM
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
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Treeview with checkbox ?
Posted: Sat Oct 25, 2008 01:10 PM
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.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Treeview with checkbox ?
Posted: Mon Oct 27, 2008 11:16 AM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Mon Oct 27, 2008 11:30 AM

Gustavo,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Treeview with checkbox ?
Posted: Mon Oct 27, 2008 12:04 PM
Gustavo,

This procedure can do it!

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