how to disable tree item
how to disable tree item
#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
#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
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
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
how to disable tree item
Thanks for your help
With the change, I get this error message:
Message not found: TTVITEM:DISABLE
Thanks
With the change, I get this error message:
Message not found: TTVITEM:DISABLE
Thanks
acwoo
how to disable tree item
Thanks
enableWindow( oItem:hItem, lEnable )
How do I change this to run
Thanks
enableWindow( oItem:hItem, lEnable )
How do I change this to run
Thanks
acwoo
Acwoo,
Something like this:
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
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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
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
Acwoo,
As Antonio told you... please, try this:
You can too make a function to control this operation like this:
And use in your source code like this:
As Antonio told you... please, try this:
Code: Select all
SendMessage( oTree:hWnd, TVM_DELETEITEM, 0, oItem:hItem )
Code: Select all
function deleteItem( oTree, oItem )
SendMessage( oTree:hWnd, TVM_DELETEITEM, 0, oItem:hItem )
return
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
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9