FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour how to disable tree item
Posts: 45
Joined: Fri Sep 28, 2007 08:53 AM
how to disable tree item
Posted: Tue Nov 11, 2008 10:45 AM

include "FiveWin.ch"

include "WColors.ch"

function Main()

local oDlg, oTree

DEFINE DIALOG oDlg TITLE "TreeView from source"

@ 0.5, 1 TREEVIEW oTree OF oDlg SIZE 80, 60 COLOR 0, GetSysColor( COLOR_WINDOW )

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT AddItems( oTree )

return nil

function AddItems( oTree )

local oItem1, oItem2, oItem3

oItem1 = oTree:Add( "First" )
oItem1:Add( "One" )
oItem1:Add( "Two" )
oItem1:Add( "Three" )
oItem2 = oTree:Add( "Second" )
oItem2:Add( "Hello" )
oItem2:Add( "World" )
oItem3 = oTree:Add( "Third" )
oItem3:Add( "Last" )
oItem3:Add( "item" )

return nil

How do I disable oItem1:Add( "Two" )

Thanks

acwoo
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
how to disable tree item
Posted: Tue Nov 11, 2008 11:53 AM
Try this:

function AddItems( oTree )

local oItem1, oItem2, oItem3, oSubItem

oItem1 = oTree:Add( "First" )
oItem1:Add( "One" )

oSubitem := oItem1:Add( "Two" )
oSubitem:disable()

oItem1:Add( "Three" )
oItem2 = oTree:Add( "Second" )
oItem2:Add( "Hello" )
oItem2:Add( "World" )
oItem3 = oTree:Add( "Third" )
oItem3:Add( "Last" )
oItem3:Add( "item" )

return nil
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: 45
Joined: Fri Sep 28, 2007 08:53 AM
how to disable tree item
Posted: Tue Nov 11, 2008 12:10 PM

Thanks for your help

With the change, I get this error message:

Message not found: TTVITEM:DISABLE

Thanks

acwoo
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
how to disable tree item
Posted: Tue Nov 11, 2008 12:26 PM

It's possible to make the treeview disabled.
I think maybe not's possible to do the same thing with a item of treeview.

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
how to disable tree item
Posted: Tue Nov 11, 2008 12:27 PM
Acwoo,

Please, try this:
enableWindow( oItem:hItem, lEnable )
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: 45
Joined: Fri Sep 28, 2007 08:53 AM
how to disable tree item
Posted: Tue Nov 11, 2008 01:00 PM

Thanks

enableWindow( oItem:hItem, lEnable )

How do I change this to run

Thanks

acwoo
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
how to disable tree item
Posted: Tue Nov 11, 2008 01:33 PM
Acwoo,

Something like this:

function AddItems( oTree )

local oItem1, oItem2, oItem3, oSubItem

oItem1 = oTree:Add( "First" )
oItem1:Add( "One" )

oSubitem := oItem1:Add( "Two" )
enableWindow( oSubItem:hItem, .F. )

oItem1:Add( "Three" )
oItem2 = oTree:Add( "Second" )
oItem2:Add( "Hello" )
oItem2:Add( "World" )
oItem3 = oTree:Add( "Third" )
oItem3:Add( "Last" )
oItem3:Add( "item" )

return nil
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: 45
Joined: Fri Sep 28, 2007 08:53 AM
how to disable tree item
Posted: Tue Nov 11, 2008 01:49 PM

Thanks

Tree "Two" not disabled.

Thanks

acwoo
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
how to disable tree item
Posted: Tue Nov 11, 2008 01:54 PM

Ok!

I think that not's possible to do!

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
how to disable tree item
Posted: Tue Nov 11, 2008 06:16 PM

Acwoo,

Antonio or Uwe or James, maybe they can help you!

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
how to disable tree item
Posted: Tue Nov 11, 2008 09:20 PM

Acwoo,

You can delete a TreeView item (including its childen items) and later on add it again:

http://msdn.microsoft.com/en-us/library/bb773560(VS.85).aspx

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 45
Joined: Fri Sep 28, 2007 08:53 AM
how to disable tree item
Posted: Wed Nov 12, 2008 06:41 AM

Thanks

how do I use this TVM_Deleteitem to run

Thanks

acwoo
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
how to disable tree item
Posted: Wed Nov 12, 2008 07:28 PM
Acwoo,

As Antonio told you... please, try this:
SendMessage( oTree:hWnd, TVM_DELETEITEM, 0, oItem:hItem )


You can too make a function to control this operation like this:
function deleteItem( oTree, oItem )
  
  SendMessage( oTree:hWnd, TVM_DELETEITEM, 0, oItem:hItem )

return


And use in your source code like this:
function AddItems( oTree )

local oItem1, oItem2, oItem3, oSubItem

oItem1 = oTree:Add( "First" )
oItem1:Add( "One" )

oSubitem := oItem1:Add( "Two" )
deleteItem( oTree, oSubItem )

oItem1:Add( "Three" )
oItem2 = oTree:Add( "Second" )
oItem2:Add( "Hello" )
oItem2:Add( "World" )
oItem3 = oTree:Add( "Third" )
oItem3:Add( "Last" )
oItem3:Add( "item" )

return nil
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: 45
Joined: Fri Sep 28, 2007 08:53 AM
how to disable tree item
Posted: Thu Nov 13, 2008 01:16 PM

Thanks

acwoo

Continue the discussion