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
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
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
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.
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 )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 87 guests