wxpython + follow selection in objectlistview in a second objectlistview

104 views Asked by At

I have a objectlistview which gives me some data after I've done some filtering on it (mediamonkey-style if someone knows it). Now I have a second screen where I have to show the same objectlistview (same result of the filtering). This step I already programmed. Now when the user select a row on objectlistview 1, I need the second obectlistview to show the same selection.

Is this possible and how do you do it? maybe it is something like: getselection of objectlistview 1, and see where it is in objectlistview 2 and select it?

tx in advance

EDIT: Update: I send a pubsubmessage on selection in objectlistview1, to objectlistview2, but can you give a cell the focus/selection programmatically?

1

There are 1 answers

0
VeVi On

Okay, I've solved it this way (I don't know if it is the best way, but it works :) ). I use GetSElectedObject() and SelectObject().

On item selection in OLV-1:

def on_item_selection(self, event):

    pub.sendMessage("CellSelectionItemlist",
                Container(master=self, origin=self.itemlist,data=self.OLV-1.GetSelectedObject()))

In other file:

def __init__(self, parent, id):
    pub.subscribe(self.on_Cell_Selection, "CellSelectionItemlist")

def on_Cell_Selection(self,message):

    selectedCell = message.data.data
    self.MACellList.SelectObject(selectedCell, ensureVisible=True,deselectOthers=True)