Hi
Attached is a patch to add a ''traverse'' method to walk through
a
TreeCtrl''s items. It accepts a block and yields each TreeItemId in turn
into it:
# print all the labels in the tree:
tree.traverse { | item | puts tree.get_item_text(item) }
It can optionally accept the id of a branch to start at
# embolden all items at branch and below:
tree.traverse(branch) { | item | puts tree.set_item_bold(item) }
Wanted to check if anyone sees any probs or thinks this is a bad idea.
It''s kind of sugary, but would be a lot slower and messier in Ruby,
plus
we already had the recursive C++ code written to do the GC marking. One
use case is finding the item whose item data is a particular ruby
object, eg when that object has been updated elsewhere.
alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: treectrl_traverse.patch
Url:
rubyforge.org/pipermail/wxruby-development/attachments/20061201/aafa0789/attachment.ksh