Treeview with checkbox ?

Postby anserkk » Wed Oct 15, 2008 8: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
User avatar
anserkk
 
Posts: 1330
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby Antonio Linares » Wed Oct 15, 2008 8:16 am

Hakan,

yes, some changes are required.

We are still testing them.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41323
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Horizon » Wed Oct 15, 2008 8: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.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Postby Antonio Linares » Wed Oct 15, 2008 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41323
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Horizon » Wed Oct 15, 2008 8:55 am

Antonio,

I can wait it.

Thanks,
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Postby goosfancito » Wed Oct 15, 2008 4: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
Code: Select all  Expand view
#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
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Postby goosfancito » 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
Code: Select all  Expand view
#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
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Postby JC » 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:
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
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby James Bott » Sat Oct 25, 2008 12:12 am

Júlio,

Will you show us how you did it?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41323
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » 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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby goosfancito » Sat Oct 25, 2008 1: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/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Postby JC » 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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41323
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Mon Oct 27, 2008 12:04 pm

Gustavo,

This procedure can do it!

Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

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