FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oTree:setCheck() Error!
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
oTree:setCheck() Error!
Posted: Tue Aug 26, 2008 02:58 PM
Hi Antonio, James and friends!

I have a little doubt... When I try to check a TVItem, the fivewin gives me the following error:
Application
===========
   Path and name: C:\xGenesis\genesis.EXE (32 bits)
   Size: 1,409,536 bytes
   Time from start: 0 hours 0 mins 42 secs 
   Error occurred at: 26/08/2008, 11:57:28
   Error description: Error BASE/1004  Message not found: TTVITEM:HWND

Stack Calls
===========
   Called from: source\rtl\tobject.prg => TTVITEM:ERROR(172)
   Called from: source\rtl\tobject.prg => TTVITEM:MSGNOTFOUND(181)
   Called from: source\rtl\tobject.prg => TTVITEM:HWND(0)
   Called from: .\source\classes\TTreeVie.PRG => (b)TTREEVIEW:TTREEVIEW(0)
   Called from:  => TTREEVIEW:SETCHECK(0)


I'm using like this: oTree:setCheck( oItem, .T. )

The method setCheck above returns a error for the oItem:hWnd
METHOD SetCheck( oItem, lOnOff ) INLINE ; 
      If( oItem == nil, oItem := ::GetSelected(), nil ), ; 
      TVSetCheck( ::hWnd, oItem:hWnd, lOnOff )
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: 445
Joined: Thu Feb 21, 2008 11:58 AM
oTree:setCheck() Error!
Posted: Tue Aug 26, 2008 04:37 PM
I execute a loop into a oMenu:aItems for get the prompts for adding like a option by the TreeView.
STATIC FUNCTION loadTreeAccess( oMenu, oTree )

LOCAL oRoot
LOCAL aItens := {}
LOCAL nPos   := 0

aItens := oMenu:aItems

FOR nPos := 1 TO len( aItens )

    IF valType( aItens[nPos]:bAction ) == "O" .AND. upper( aItens[nPos]:bAction:className() ) == "TMENU"

       oRoot := oTree:add( strtran( aItens[nPos]:cPrompt, "&", "" ), 1 )
       loadTreeAccess( aItens[nPos]:bAction, oRoot )

    ELSEIF !empty( aItens[nPos]:cargo )

       oTree:add( strtran( aItens[nPos]:cPrompt, "&", "" ), 1, aItens[nPos]:cargo )

    ENDIF

NEXT

RETURN( oTree )


I see the Tree normally, but cannot check the option with setCheck() method.
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: 445
Joined: Thu Feb 21, 2008 11:58 AM
oTree:setCheck() Error!
Posted: Tue Aug 26, 2008 05:02 PM
I solved this using directly the function called by the method

TVSetCheck( oObjTree:hWnd, oObjItem:hItem, .T. )
and
TVGetCheck( oObjTree:hWnd, oObjItem:hItem )

But, the method not works! The erros is the exchange of oObjItem:hItem for oObjItem:hWnd
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: 445
Joined: Thu Feb 21, 2008 11:58 AM
oTree:setCheck() Error!
Posted: Fri Aug 29, 2008 04:41 PM

Somebody!?

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: 44162
Joined: Thu Oct 06, 2005 05:47 PM
oTree:setCheck() Error!
Posted: Sat Aug 30, 2008 06:07 AM
JĂșlio,

Yes, you are right, its a bug in Class TTreeView. Fixed, thanks! :-)

This is the right code:
   METHOD GetCheck( oItem ) INLINE ; 
      If( oItem == nil, oItem := ::GetSelected(), nil ), ; 
      TVGetCheck( ::hWnd, oItem:hItem ) 

   METHOD SetCheck( oItem, lOnOff ) INLINE ; 
      If( oItem == nil, oItem := ::GetSelected(), nil ), ; 
      TVSetCheck( ::hWnd, oItem:hItem, lOnOff )

Both methods had the bug
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion