[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnumed-devel] wxEvents question
From: |
Sebastian Hilbert |
Subject: |
[Gnumed-devel] wxEvents question |
Date: |
Thu, 29 Apr 2004 22:46:08 +0200 |
User-agent: |
KMail/1.6.1 |
I would like to extend the functionality of gmPhrasewheel in a way that when
an item has been selected certain actions are initiated.
Therefore I looked at the wx event handling and I am totally lost.
One is supposed to define an custom event. I did this as described on this
page:
http://wiki.wxpython.org/index.cgi/CustomEventClasses
but I am not sure where to add the code. Here is what I did.
1.) modified gmPhraseWheel
def __on_enter (self):
"""Called when the user pressed <ENTER>.
FIXME: this might be exploitable for some nice statistics ...
"""
# if we have a pick list
if self.__picklist_visible:
# tell the input field about it
self.on_list_item_selected()
else:
self.propagate_select_evt()
I basically added the part after else:
2.) #--------------------------------------------------------
# custom event handler
#--------------------------------------------------------
def propagate_select_evt (self):
"""emits an custom event to enable autoupdate of dependend
controls based on
selected list item"""
wxPostEvent(self, ItemSelectedEvent())
3.) added in gmPhraseWheel and/or gmLabJournal
wxEVT_ITEM_SELECTED = wxNewEventType()
#============================================================
def EVT_ITEM_SELECTED(win, func):
win.Connect(-1, -1, wxEVT_ITEM_SELECTED, func)
#============================================================
class ItemSelectedEvent(wxPyCommandEvent):
def __init__(self):
wxPyCommandEvent.__init__(self)
self.SetEventType(wxEVT_ITEM_SELECTED)
I probably screwed up this part. Where does one add 3.) in
gmPhrasewheel or
in gmLabJournal?
It would be great if someone could fix this. I don't know where to look. Once
I have a working example I could add this event to many more places in my
code.
You can take a look at gmLabJournal. It's in CVS. It's very incomplete though
since I spend way too much time trying to figure out the basics.
--
Sebastian Hilbert
Leipzig / Germany
[www.openmed.org] -> PGP welcome, HTML ->/dev/null
ICQ: 86 07 67 86 -> No files, no URL's
My OS: Suse Linux. Geek by Nature, Linux by Choice
Unterstützen Sie die Entwicklung von Gnumed durch Ihren
Internet - Einkauf unter der Adresse:
http://profiseller.de/shop1/index.php3?ps_id=P1658133
- [Gnumed-devel] wxEvents question,
Sebastian Hilbert <=