how to disable tree item

Post Reply
acwoo
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia
Contact:

how to disable tree item

Post by acwoo »

#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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Try this:

Code: Select all

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
acwoo
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia
Contact:

how to disable tree item

Post by acwoo »

Thanks for your help

With the change, I get this error message:

Message not found: TTVITEM:DISABLE


Thanks
acwoo
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Acwoo,

Please, try this:

Code: Select all

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
acwoo
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia
Contact:

how to disable tree item

Post by acwoo »

Thanks

enableWindow( oItem:hItem, lEnable )

How do I change this to run

Thanks
acwoo
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Acwoo,

Something like this:

Code: Select all

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
acwoo
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia
Contact:

how to disable tree item

Post by acwoo »

Thanks

Tree "Two" not disabled.


Thanks
acwoo
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Acwoo,

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

http://msdn.microsoft.com/en-us/library ... S.85).aspx
regards, saludos

Antonio Linares
www.fivetechsoft.com
acwoo
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia
Contact:

how to disable tree item

Post by acwoo »

Thanks

how do I use this TVM_Deleteitem to run


Thanks
acwoo
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Acwoo,

As Antonio told you... please, try this:

Code: Select all

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

Code: Select all

function deleteItem( oTree, oItem )
  
  SendMessage( oTree:hWnd, TVM_DELETEITEM, 0, oItem:hItem )

return
And use in your source code like this:

Code: Select all

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
acwoo
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia
Contact:

how to disable tree item

Post by acwoo »

Thanks
acwoo
Post Reply