I'm very busy now, (that's why I haven't replied on the custom draw thread,) so if you sent me a sample program it would make it easier to take a look.


Mark, no problem, I can wait. Here is a sample program, and as you can see the items are identical. Right-click an item to delete.

.class1~run

::CLASS Class1 SUBCLASS UserDialog INHERIT ResizingAdmin
::REQUIRES "ooDialog.cls"

::METHOD run CLASS
  treeView = self~new
  treeView~execute("SHOWTOP")

::METHOD init
  self~init:super()
  self~create(0, 100, 170, 300, "")

::METHOD defineDialog
  expose menu
  u = .DlgAreaU~new(self)
  self~createTreeView(100, u~x, u~y, u~w, u~h, "ATROOT BUTTONS LINES HSCROLL SHOWSELALWAYS NODRAG INFOTIP")
  menu = .PopupMenu~new(200)
  menu~insertItem(1, 201, "Delete", , , .true)
  forward class(super)

::METHOD initDialog
  expose tree menu
  tree = self~newTreeView(100)
  self~buildTree
  menu~assignTo(self)
  menu~connectContextMenu(onListViewContext, tree~hwnd)
  menu~connectCommandEvent(201, "onItemDelete")

::METHOD buildTree PRIVATE
  expose tree
  p1 = tree~insert("ROOT", , "Root1", , , "EXPANDED", .TRUE)
  p2 = tree~insert(p1, , "ABC", , , , .FALSE)
  p1 = tree~insert("ROOT", , "Root2", , , "EXPANDED", .TRUE)
  p2 = tree~insert(p1, , "ABC", , , , .FALSE)
  p1 = tree~insert("ROOT", , "Root3", , , "EXPANDED", .TRUE)
  p2 = tree~insert(p1, , "ABC", , , , .FALSE)

::METHOD onListViewContext UNGUARDED
  expose tree menu
  use arg hwnd, x, y
  pos = .Point~new(x, y)
  tree~screen2client(pos)
  hItem = tree~hitTestInfo(pos)~hItem
  reply 0
  if hItem <> 0 then do
     tree~select(hItem)
     menu~show(.Point~new(x, y))
  end

::METHOD onItemDelete UNGUARDED
  expose tree
  reply 0
  self~deleteItems(tree~selected)

::METHOD deleteItems
  expose tree
  use strict arg hItem
  text = tree~itemText(hItem)
  do forever
     found = tree~find(text)
     if found = 0 then leave
     tree~delete(found)
  end