Problemas SetCheck Tree

Post Reply
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Problemas SetCheck Tree

Post by marca »

Ola Pessoal
Mesmo com a dica do timer nao funcionou

Nao funciona e executa varias vezes o array e mesmo com o Timer nao esta marcando o SetCheck
FUNCTION TreeChk()
LOCAL oDlg, oTree, oBtn
PRIVATE oMenu ,oSubMenu,oPlano := {}

oPlano := SqlArray("SELECT codigo,descricao FROM planoCont " )
oMenu := Len( oPlano ), oSubMenu := Array( 3 )

DEFINE DIALOG oDlg

@ 0, 0 TREEVIEW oTree OF oDlg SIZE 100, 150 CHECKBOXES

@ 3, 20 BUTTON oBtn PROMPT "Test"

ACTIVATE DIALOG oDlg CENTERED ON INIT TreeInit( oTree, oDlg )
MsgInfo( oTree:aItems[ 1 ]:GetCheck() )

return nil

FUNCTION TreeInit( oTree, oDlg )

local oTmr

DEFINE TIMER oTmr OF oDlg ACTION BuildTree( oTree, oDlg ), oTmr:End()

ACTIVATE TIMER oTmr

RETURN nil

FUNCTION BuildTree( oTree, oDlg )
LOCAL nI
FOR nI = 1 To Len( oPlano )
oMenu[ nI ] = oTree:Add( Str(oPlano[nI,1] ,3) + "-" + oPlano[nI,2] )
oTree:SetCheck( oMenu[ nI ], .T. )

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

*oMenu[ 2 ]:= oTree:Add( "Proyectos" )
* oSubMenu[ 2 ]:= oMenu[ 2 ]:Add( "Definir Proyectos" )
* oTree:SetCheck( oSubMenu[ 2 ], .T. )
* oSubmenu[ 3 ]:= oMenu[ 2 ]:Add( "Actualización datos" )
NEXT

oTree:Expand()

return nil
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Problemas SetCheck Tree

Post by Antonio Linares »

Marcelo,

Prueba este ejemplo:

Code: Select all

#include "FiveWin.ch"

    memvar oMenu, oSubMenu

    function TreeChk()   
       
       local oDlg, oTree, oBtn
       private oMenu := Array( 3 ), oSubMenu := Array( 3 )

       DEFINE DIALOG oDlg

       @ 0, 0 TREEVIEW oTree OF oDlg SIZE 100, 150 CHECKBOXES
            
       @ 3, 20 BUTTON oBtn PROMPT "Test"
        
       ACTIVATE DIALOG oDlg CENTERED ON INIT TreeInit( oTree, oDlg )

    return nil

    function TreeInit( oTree, oDlg )
    
       local oTmr
       
       DEFINE TIMER oTmr OF oDlg ACTION BuildTree( oTree, oDlg ), oTmr:End()
       
       ACTIVATE TIMER oTmr
       
    return nil   

    function BuildTree( oTree, oDlg )

       oMenu[ 1 ] = oTree:Add( "Principal" )
          oTree:SetCheck( oMenu[ 1 ], .T. )
         
       oSubMenu[ 1 ] = oMenu[ 1 ]:Add( "Imprimir..." )
         
       oMenu[ 2 ]:= oTree:Add( "Proyectos" )
          oSubMenu[ 2 ]:= oMenu[ 2 ]:Add( "Definir Proyectos" )
          oTree:SetCheck( oSubMenu[ 2 ], .T. )
          oSubmenu[ 3 ]:= oMenu[ 2 ]:Add( "Actualización datos" )

       oTree:Expand()

    return nil
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Re: Problemas SetCheck Tree

Post by marca »

Ola Antonio

Ná verdade um dos problemas estava no codigo

Observe aqui

PRIVATE oMenu ,oSubMenu,oPlano := {}


oMenu := Len( oPlano ), oSubMenu := Array( 3 ) estava errado

o Correto seria
PRIVATE oMenu := {} ,oSubMenu := {} ,oPlano := {}
oMenu := Array( Len( oPlano ) ), oSubMenu := Array( 3 )

Isso Resolveu parte do problema


Agora estou com outro problema

Gostaria q. as Opcoes dos menus tivesse cores diferentes das do SubMenus é possivel ?
oTree:SetColor( oMenu[ 1 ], CLR_BLACK )


oTree:SetColor( oSubMenu[ 2 ], CLR_RED )


Entendeu ?
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Problemas SetCheck Tree

Post by vilian »

Marcelo,

Você conseguiu colocar cores diferentes nos itens do Tree ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Re: Problemas SetCheck Tree

Post by marca »

Olá Vilian

Não e até hoje como vc pode ver ai obtive um retorno de minha pergunta que irá fazer um ano
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
Post Reply