how to disable tree item

how to disable tree item

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

Postby JC » Tue Nov 11, 2008 11:53 am

Try this:

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

how to disable tree item

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

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

Postby JC » Tue Nov 11, 2008 12:27 pm

Acwoo,

Please, try this:
Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

how to disable tree item

Postby acwoo » Tue Nov 11, 2008 1:00 pm

Thanks

enableWindow( oItem:hItem, lEnable )

How do I change this to run

Thanks
acwoo
acwoo
 
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia

Postby JC » Tue Nov 11, 2008 1:33 pm

Acwoo,

Something like this:

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

how to disable tree item

Postby acwoo » Tue Nov 11, 2008 1:49 pm

Thanks

Tree "Two" not disabled.


Thanks
acwoo
acwoo
 
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia

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

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

Postby Antonio Linares » Tue Nov 11, 2008 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

how to disable tree item

Postby acwoo » Wed Nov 12, 2008 6:41 am

Thanks

how do I use this TVM_Deleteitem to run


Thanks
acwoo
acwoo
 
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia

Postby JC » Wed Nov 12, 2008 7:28 pm

Acwoo,

As Antonio told you... please, try this:
Code: Select all  Expand view
SendMessage( oTree:hWnd, TVM_DELETEITEM, 0, oItem:hItem )


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

return


And use in your source code like this:
Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

how to disable tree item

Postby acwoo » Thu Nov 13, 2008 1:16 pm

Thanks
acwoo
acwoo
 
Posts: 45
Joined: Fri Sep 28, 2007 8:53 am
Location: Makaysia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests