Needed a routine to enumerate visible items in a TreeView. Okay, easy
task - MS provides macros. First use TreeView_GetFirstVisible and then
let TreeView_GetNextVisible run in a loop. Simple enough, until one
encounters MS logic.. (of course the above fails)
Time to read the docs - for TreeView_GetNextVisible MS says, "The specified
item must be visible. Use the TVM_GETITEMRECT message to determine whether
an item is visible". Logic, eh? To use GetNextVisible, we must first make
sure next item really is visible? Sigh..
Anyway - following works, in case someone needs it:
------------------
task - MS provides macros. First use TreeView_GetFirstVisible and then
let TreeView_GetNextVisible run in a loop. Simple enough, until one
encounters MS logic.. (of course the above fails)
Time to read the docs - for TreeView_GetNextVisible MS says, "The specified
item must be visible. Use the TVM_GETITEMRECT message to determine whether
an item is visible". Logic, eh? To use GetNextVisible, we must first make
sure next item really is visible? Sigh..
Anyway - following works, in case someone needs it:
Code:
hItem = TreeView_GetFirstVisible(hTree) WHILE hItem IF TreeView_GetItemRect(hTree, hItem, rc, %TRUE) THEN 'make sure it's visible ' do stuff hItem = TreeView_GetNextVisible(hTree, hItem) 'look for next visible END IF WEND
------------------
Comment