oTree:setCheck() Error!

oTree:setCheck() Error!

Postby JC » Tue Aug 26, 2008 2: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:
Code: Select all  Expand view
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
Code: Select all  Expand view
METHOD SetCheck( oItem, lOnOff ) INLINE ;
      If( oItem == nil, oItem := ::GetSelected(), nil ), ;
      TVSetCheck( ::hWnd, oItem:hWnd, lOnOff )
Last edited by JC on Thu Aug 28, 2008 6:57 pm, edited 2 times in total.
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 JC » Tue Aug 26, 2008 4:37 pm

I execute a loop into a oMenu:aItems for get the prompts for adding like a option by the TreeView.
Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

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

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

Postby Antonio Linares » Sat Aug 30, 2008 6:07 am

Júlio,

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

This is the right code:
Code: Select all  Expand view
   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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

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