notgeekenough has asked for the wisdom of the Perl Monks concerning the following question:

I using Tix in python and am having problems with the HList. Noone in the python forums can answer my questions and the documentation I can find does not help either. I have multiple HLists all tied to a database some of which are changing as the program runs. The biggest issue I am having is that I have to delete all the entries in the list each time I poll the database. I would like to check each entry from the database with the HList and add it if it does not exists. I would also like to sort by a column, print the entries in a csv file and determine if an item is in the list. All of these could be solved if I could just figure out a way to get the entry and path using the entry id but I cannot find the function to do so. Is there a HList method to get a entry path using the entry id? Thanks

Replies are listed 'Best First'.
Re: Tix HList Help
by jethro (Monsignor) on Aug 08, 2009 at 13:45 UTC
    Use a separate list that you can manipulate, compare to the database and sort. And write a subroutine that copies that list into the appropriate HList if there was any change.
Re: Tix HList Help
by Anonymous Monk on Aug 08, 2009 at 13:22 UTC
    That is hysterical.

    All of these could be solved if I could just figure out a way to get the entry and path using the entry id but I cannot find the function to do so. Is there a HList method to get a entry path using the entry id? Thanks

    What id? AFAIK, there are only paths.

      Why is it hysterical? I don't know how it works in perl but in python I would type (assuming row is a MySQLdb cursor)
      entry = row['pkey'] list.add(entry,itemtype=TEXT,text=row['name'] list.item_create(entry,1,text=row['gender'] list.item_create(entry,2,text=row['age']
      Here, entry is what I would refer to as the 'id'. In response to a right click I can have
      sel = list.nearest(event.y_root) list.selection_set(sel) # query db for info using the key sel
      Here, sel is the 'entry' (db primary key) of the nearest 'row' in the list to the right click. This is a good example of what I want to do. I would like to pass to another process the information in the HList corresponding to the entry defined by sel. But to do so I have to query the database. Can I not just retrieve the path?
        Why is it hysterical?

        Because the ironing is delicious.

        Here, entry is what I would refer to as the 'id'.

        Why? Everyone else calls it the path.