Module: Wx::GenericDirCtrl::DirCtrlTree

Defined in:
lib/wx/classes/genericdirctrl.rb

Instance Method Summary collapse

Instance Method Details

#get_item_data(tree_id) ⇒ Object Also known as: get_item_path

The TreeCtrl contained in a GenericDirCtrl already has C++ data associated with the items. If these are returned to Ruby crashes will result. So this module sets the TreeCtrl to return the path string.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/wx/classes/genericdirctrl.rb', line 8

def get_item_data(tree_id)
  root_id = get_root_item
  return "" if tree_id == root_id

  path = item_text(tree_id)
  while tree_id = item_parent(tree_id) and tree_id != root_id
    path = item_text(tree_id) + "/#{path}" 
  end
  unless Wx::PLATFORM == 'WXMSW'
    path = "/" + path
  end
  path
end

#set_item_data(tree_id, data) ⇒ Object

Not allowed



25
26
27
# File 'lib/wx/classes/genericdirctrl.rb', line 25

def set_item_data(tree_id, data)
  Kernel.raise "Item data cannot be set for a GenericDirCtrl's Tree"
end