Associating Data In Two Widgets

In the wPIA book's Chapter 15 I do not find a function that will allow me
to load values into a list control that are associated with a highlighted
value in a tree control.

   What I want to accomplish is to have any defined values associated with a
tree control item displayed in the list control (non-editable there), and
have this display dynamically updated as the cursor is scrolled over items
and sub-items in the tree.

   I haven't found an event that is triggered by having the cursor on an
item. So I assume that the user needs to click on an item to trigger the
event; the selected item is then identified with GetItem(). Is this correct?

   Both sets of data are stored in separate SQLite3 tables.

   Pointers to relevant information appreciated.

Rich

···

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Hi Rich,

Rich Shepard wrote:

  In the wPIA book's Chapter 15 I do not find a function that will allow me
to load values into a list control that are associated with a highlighted
value in a tree control.

  What I want to accomplish is to have any defined values associated with a
tree control item displayed in the list control (non-editable there), and
have this display dynamically updated as the cursor is scrolled over items
and sub-items in the tree.

In a listctrl I use:
EVT_LIST_ITEM_SELECTED(id, func) The item has been selected.

I expected to see the same in the treelist, but maybe this will do the trick
EVT_TREE_SEL_CHANGED(id, func) Selection has changed.

Hope this helps
Werner

···

  I haven't found an event that is triggered by having the cursor on an
item. So I assume that the user needs to click on an item to trigger the
event; the selected item is then identified with GetItem(). Is this correct?

  Both sets of data are stored in separate SQLite3 tables.

  Pointers to relevant information appreciated.

Rich

I persume you mean "hovering over an item". I would try wx.EVT_MOTION
and wx.EVT_LEAVE_WINDOW. Specifically...

class myTreeCtrl(wx.TreeCtrl):
    def __init__(self, ...):
        ...
        self.Bind(wx.EVT_MOTION, self.mouseMoved)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.mouseLeft)
        self.timer = wx.Timer(self, wx.NewId())
        self.Bind(wx.EVT_TIMER, self.updateListCtrl, self.timer)
        self.xy = None
        ...

    def mouseMoved(self, evt):
        #replace 250 with the 'hover delay' you want in milliseconds.
        self.timer.Start(250, wx.TIMER_ONE_SHOT)
        self.xy = evt.GetX(), evt.GetY()
        evt.Skip()

    def mouseLeft(self, evt):
        self.timer.Stop()
        evt.Skip()

    def updateListCtrl(self, evt):
        item, flag = self.HitTest(self.xy)
        ...

- Josiah

···

Rich Shepard <rshepard@appl-ecosys.com> wrote:

   In the wPIA book's Chapter 15 I do not find a function that will allow me
to load values into a list control that are associated with a highlighted
value in a tree control.

   What I want to accomplish is to have any defined values associated with a
tree control item displayed in the list control (non-editable there), and
have this display dynamically updated as the cursor is scrolled over items
and sub-items in the tree.

   I haven't found an event that is triggered by having the cursor on an
item. So I assume that the user needs to click on an item to trigger the
event; the selected item is then identified with GetItem(). Is this correct?

Werner,

   Thank you. I'll try that. I can't find the documentation for that handler
in either the book or the on-line new API documents.

Rich

···

On Mon, 6 Nov 2006, Werner F. Bruhin wrote:

I expected to see the same in the treelist, but maybe this will do the
trick EVT_TREE_SEL_CHANGED(id, func) Selection has changed.

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Thank you, Josiah.

   Where are all these widget events documented? I'm having difficulty
locating them all.

Rich

···

On Mon, 6 Nov 2006, Josiah Carlson wrote:

I presume you mean "hovering over an item". I would try wx.EVT_MOTION
and wx.EVT_LEAVE_WINDOW. Specifically...

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Hi Rich,

Rich Shepard wrote:

I presume you mean "hovering over an item". I would try wx.EVT_MOTION
and wx.EVT_LEAVE_WINDOW. Specifically...

  Thank you, Josiah.

  Where are all these widget events documented? I'm having difficulty
locating them all.

I use the helpful ctrl-h in Boa :wink: , and on my system this brings up little bit outdated wxWidgets 2.5.3 doc.

I hope that at some point this will show up in the new API doc too, I guess this is on Robin's todo list.

Werner

···

On Mon, 6 Nov 2006, Josiah Carlson wrote:

Rich

^^^^^^^^^

   A-ha! Thanks. That's also available on the Web.

Rich

···

On Mon, 6 Nov 2006, Werner F. Bruhin wrote:

I use the helpful ctrl-h in Boa :wink: , and on my system this brings up little bit outdated wxWidgets 2.5.3 doc.

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

I install the documentation and demos for my platform. Because my
platform happens to be Windows, it includes a .chm help file, which I
use. It's searchable, but I primarily use the "Alphabetical Class
Reference". The EVT_MOTION and EVT_LEAVE_WINDOW trigger wx.MouseEvent,
which you can also look up.

- Josiah

···

Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Mon, 6 Nov 2006, Josiah Carlson wrote:

> I presume you mean "hovering over an item". I would try wx.EVT_MOTION
> and wx.EVT_LEAVE_WINDOW. Specifically...

   Thank you, Josiah.

   Where are all these widget events documented? I'm having difficulty
locating them all.