How to Refresh a TreeView

Post Reply
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

How to Refresh a TreeView

Post by ctoas »

How to Refresh a TreeView??

see the source

Code: Select all

********************************************************************************
STATIC FUNCTION TESTE()
********************************************************************************

    STATIC oTREE

    DEFINE DIALOG oDlg RESOURCE "CAD"

        oTree := TTreeView():Redefine( 4024, oDlg )

        REDEFINE BUTTONBMP oBtn ID 4025 OF oDlg ACTION ATUALIZATREE(oTree)

   ACTIVATE DIALOG oDlg CENTERED ON INIT MONTATREE( oTree )

RETURN NIL


********************************************************************************
FUNCTION MONTATREE( oTree )
********************************************************************************

   oITEM[01]:= oTREE:ADD( "ITEM1" )
      oSUBITEM[01]:=oITEM[01]:ADD( "ITEM1A" )
      oSUBITEM[02]:=oITEM[01]:ADD( "ITEM1B" )
      oSUBITEM[03]:=oITEM[01]:ADD( "ITEM1C" )
      oSUBITEM[04]:=oITEM[01]:ADD( "ITEM1D" )

   oITEM[02]:= oTREE:ADD( "ITEM2" )
      oSUBITEM[05]:=oITEM[02]:ADD( "ITEM2A" )
      oSUBITEM[06]:=oITEM[02]:ADD( "ITEM2B" )
      oSUBITEM[07]:=oITEM[02]:ADD( "ITEM2C" )
      oSUBITEM[08]:=oITEM[02]:ADD( "ITEM2D" )

    oTREE:EXPAND()

RETURN NIL

********************************************************************************
FUNCTION ATUALIZATREE(oTree)
********************************************************************************

   oITEM[01]:SETCHECK(.T.)
   oSUBITEM[01]:SETCHECK(.T.)
   oSUBITEM[02]:SETCHECK(.T.)
   oSUBITEM[03]:SETCHECK(.T.)
   oSUBITEM[04]:SETCHECK(.T.)

   oITEM[02]:SETCHECK(.T.)
   oSUBITEM[05]:SETCHECK(.T.)
   oSUBITEM[06]:SETCHECK(.T.)
   oSUBITEM[07]:SETCHECK(.T.)
   oSUBITEM[08]:SETCHECK(.T.)

   oTree:REFRESH() // there is no such method <-------------------

RETURN NIL
 
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
sambomb
Posts: 385
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil
Contact:

Re: How to Refresh a TreeView

Post by sambomb »

Era pra ter sim!
TTreeView herda de TControl
TControl herda de TWindow

E não existe um método virtual para o comando refresh() então a TTreeView herda o Refresh da TWindow.

[EDIT]Conversando com o autor depois, o erro pelo visto era que o objeto não estava instanciado corretamente.[/EDIT]
Email: SamirSSabreu@gmail.com
MSN: SamirAbreu@hotmail.com
Skype: SamirAbreu
xHarbour 1.1.0 + FwXh 8.02
xHarbour 1.2.1 + Fwhh 10.6
Post Reply