On Thu, Oct 13, 2011 at 04:33:51PM -0500, Ed Leafe wrote:
> On Oct 13, 2011, at 3:57 PM, Chris G wrote:
>
> > However I need some pointers to more documentation:-
> >
> > What parameters are passed to the callback function, the new
> > documentation at
> >
> > http://thewinecellarbook.com/daboDocTestAlt/dabo.lib.eventMixin.EventMixin.html?highlight=bindevent#dabo.lib.eventMixin.EventMixin.bindEvent
> >
> > doesn't seem to tell me. I guess it's documented somewhere but I
> > can't find it at the moment.
>
> The section on UI Events in the tutorial doc should help:
>
> https://docs.google.com/View?id=dg79jzmg_85f737ww6x#UI_Events_37346245162189007_67
> ( -or- http://j.mp/pGaSeg )
>
> Let me know if that helps clear things up.
>
>
I've read (quickly) through that a couple of times, now I'm reading it
more thoroughly again, it raises the following points for me:-
self.bindEvent(dabo.dEvents.Hit, self.handleHit) - I can't get my
mind round "but in Dabo we've simplified it so that these actions
all raise the Hit event". Surely different events need to do
different things don't they? You can't have every event for a
control (ButtonRightClick, ButtonLeftClick, KeyDown, etc.) calling
the same callback method can you? Or does one have a switch/case
statement in the callback to see what caused the event?
Later it says "Event handlers need to be written to accept a single
event object parameter. This event object will have an attribute
named 'EventData' that will contain relevant information about the
event. For example, mouse events will include the x and y coordinate
of the mouse, whether any modifier keys were pressed at the time,
and, if relevant, mouse scroll wheel information. Keyboard events
will contain the value of the key that was pressed, and also any
modifier keys. Menu events will contain the menu prompt of the
selected menu; tree events will contain info about the selected
node; grid events will contain row/column values. " but my event
handler needed two parameters:
def handleKey(self, p2):
Presumably my p2 parameter is the event object parameter, however I
can't find documentation that describes that. All I can
find is lots of places that say "...which will exist in the
event.EventData dictionary property" so I know that EventData is a
dictionary but I can't really find out anything more about 'event'
nor what keys to use to get data out of EventData.
KeyDown (and other keyboard) events - from what my code does it
seems that there is already a key handler which deals with some keys
(i.e. data entry into a field, all non-control keys simply get
entered as data) and it's only keys that *aren't* handled already
that get passed on to my key handler. This is OK but is it
documented somewhere? One *might* want to do something special with
some non-control keys, e.g. switch all to lower case or use some
upper case letters to do something special, how would one do this?
Sorry for all the questions and thank you all very much for the help so
far. I'll do my best to be constructive and I'm very willing to try and
help improve the documentation. I'm sure much of my problem is (as I
know I tend to) trying to run before I can walk! :-)
--
Chris Green
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/20111014101942.GB23418@chris