module Fzeet::TreeViewMethods

Public Instance Methods

append(text) click to toggle source
# File lib/fzeet/windows/comctl/TreeView.rb, line 250
def append(text)
        item = Item.new(text)

        tvis = Windows::TVINSERTSTRUCT.new

        tvis[:hInsertAfter] = Windows::TVI_LAST
        tvis[:hParent] = Windows::TVI_ROOT

        tvi = tvis[:item]

        tvi[:mask] = Windows::TVIF_TEXT
        tvi[:pszText] = ptext = FFI::MemoryPointer.from_string(item.text)

        item.root, item.parent = self, self
        item.handle = sendmsg(:insertitem, 0, tvis.pointer)

        item
ensure
        ptext.free
end