Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Issue 163 in los-cocos: Event order
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
codesite-nore...@google.com  
View profile  
 More options Nov 16 2010, 8:04 pm
From: codesite-nore...@google.com
Date: Wed, 17 Nov 2010 01:04:43 +0000
Local: Tues, Nov 16 2010 8:04 pm
Subject: Issue 163 in los-cocos: Event order
Status: New
Owner: ----

New issue 163 by mikejohnwyatt: Event order
http://code.google.com/p/los-cocos/issues/detail?id=163

What steps will reproduce the problem?

1. Create a heirarchy of event-handling layers.  At least one of the layers  
should have multiple child layers.  All layers should handle the same event  
and not return EVENT_HANDLED.

Example:

Scene
   BackgroundLayer (z=0)
   GuiLayer (z=1)
     AlphaButton (z=0)
     BravoButton (z=1)

2. Run the program and fire the event.

What is the expected output?

I expect the event handlers to be called in the following order:

1) BravoButton
2) AlphaButton
3) GuiLayer
4) BackgroundLayer

What do you see instead?

In reality, the order is like this:

1) BackgroundLayer
2) AlphaButton
3) BravoButton
4) GuiLayer

The problem is that the event handlers are simply pushed onto the window in  
order of the layer's children list (which is sorted with the lowest Z  
values first).  This results in the handlers being called from  
back-to-front, instead of the documented front-to-back (from  
\cocos\layer\base_layers.py: "Events are propagated to layers (from front  
to back) until some layer catches the event and accepts it.").

I need the order to be front-to-back so I can implement a basic GUI, in  
which events (like a mouse click) can be first caught by a widget (like a  
button) before being optionally passed to the background (i.e. if no button  
was clicked).

I have attached a patch file to fix this issue.  Basically I just reversed  
the order of pushing child handlers onto the window in the scene and  
layer's push_all_handlers() method.  I also removed event pushing from the  
on_enter method, since that would otherwise cause events to be registered  
in order of on_enter being called.

Attachments:
        event order fix.patch  2.4 KB


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
codesite-nore...@google.com  
View profile  
 More options Nov 22 2010, 11:53 am
From: codesite-nore...@google.com
Date: Mon, 22 Nov 2010 16:53:18 +0000
Local: Mon, Nov 22 2010 11:53 am
Subject: Re: Issue 163 in los-cocos: Event order
Updates:
        Status: Accepted

Comment #1 on issue 163 by ccanepacc: Event order
http://code.google.com/p/los-cocos/issues/detail?id=163

fwd to the general list,
http://thread.gmane.org/gmane.comp.python.cocos2d.user/1238
will summarize later.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »