Welcome to MacForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Popup that always sends message

 
   Macintosh computer (Home) -> -> Powerplant RSS
Next:  OSX: Any advantage to formatting like a *nix box?  
Author Message
David Dunham

External


Since: Oct 12, 2003
Posts: 79



(Msg. 1) Posted: Sat Nov 13, 2004 11:38 pm
Post subject: Popup that always sends message
Archived from groups: comp>sys>mac>oop>powerplant (more info?)

I've got a popup menu which I always want to hear from (via
ListenToMessage) when it's chosen. Even if the user chooses the
currently-checked item. It looks to me like there's lots of code which
is preventing this from happening.

My first thought was to avoid subclassing by creating an LAttachment,
but there's no way for the attachment to send ClickSelf to make the
tracking happen.

I can subclass (and always send BroadcastValueMessage), but I'm
wondering if there's some way not to.

--
David Dunham A Sharp, LLC
http://www.a-sharp.com/
"I say we should listen to the customers and give them what they want."
"What they want is better products for free." --Scott Adams

 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
David Phillip Oste

External


Since: Apr 25, 2004
Posts: 694



(Msg. 2) Posted: Mon Nov 15, 2004 12:40 am
Post subject: Re: Popup that always sends message [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
David Dunham <dunham.DeleteThis@SPAM_B_GONE.pensee.com> wrote:

 > I've got a popup menu which I always want to hear from (via
 > ListenToMessage) when it's chosen. Even if the user chooses the
 > currently-checked item. It looks to me like there's lots of code which
 > is preventing this from happening.
 >
 > My first thought was to avoid subclassing by creating an LAttachment,
 > but there's no way for the attachment to send ClickSelf to make the
 > tracking happen.

Sure there is. Read LPane::Click() in LPane.cp. The attachment gets
called with an msg_Click message. If the attachment returns false, the
LPane's ClickSelf() is not called.

ClickSelf is public, so the attachment can call it, THEN broadcast.

 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
taltos

External


Since: Nov 15, 2004
Posts: 1



(Msg. 3) Posted: Mon Nov 15, 2004 8:32 pm
Post subject: How do I capture mouse movements... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Okay, So I am an experienced PowerPlant programmer. Recently I have
been moving a decent sized gui project over to PPx. Many of the gui
elements that I am working with (custom panes and views and such)
require mouse tracking in the form of the old LMouseTracker
class/LPane::MouseWithin. I was going to try to use an PPx::IdleTimer,
essentially copying the behaviour of the LMouseTracker periodical, but
the PPx::IdleTimer does not send a mouse event that I can work with. I
then discovered PPx::MouseMovedDoer, but I never see the event get
posted (my DoMouseMoved method never gets called). Other things I have
tried have also proven fruitless. So how do I implement a non-blocking
mouse tracker with PPx?

Thanks,

---Phoenix...
 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
David Phillip Oste

External


Since: Apr 25, 2004
Posts: 694



(Msg. 4) Posted: Wed Nov 17, 2004 1:40 pm
Post subject: Re: How do I capture mouse movements... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Phoenix <taltos RemoveThis @sasquatch.com> wrote:

 > Okay, So I am an experienced PowerPlant programmer. Recently I have
 > been moving a decent sized gui project over to PPx. Many of the gui
 > elements that I am working with (custom panes and views and such)
 > require mouse tracking in the form of the old LMouseTracker
 > class/LPane::MouseWithin. I was going to try to use an PPx::IdleTimer,
 > essentially copying the behaviour of the LMouseTracker periodical, but
 > the PPx::IdleTimer does not send a mouse event that I can work with. I
 > then discovered PPx::MouseMovedDoer, but I never see the event get
 > posted (my DoMouseMoved method never gets called). Other things I have
 > tried have also proven fruitless. So how do I implement a non-blocking
 > mouse tracker with PPx?

Mouse down or mouse up? Mouse down tracking loops generally bottom out
on either the system call TrackMouseLocation(),
TrackMouseLocationWithOptions(), or, more rarely, TrackMouseRegion()

for mouse up tracking loops, be sure to read the "Mouse Events" section
of CarbonEvents.h. Note that CarbonEvents.h has changed since the old
"Universal Headers" days, so be sure you are looking at the copy of
CarbonEvents.h inside Carbon.framework (CarbonEvents.h is in
HIToolbox.framework, inside Carbon.framework).

Once you understand what system calls are being called, then you search
the PPx source code and examples to see how connect through the PPx
layer to your code.

Make sure you understand the difference between a

kMouseTrackingMouseDragged and a kMouseTrackingMouseMoved, return values
from the TrackMouseXXX() system calls.

and between a {kEventClassMouse, kEventMouseMoved} and
{kEventClassMouse, kEventMouseDragged} Carbon Event.

Note that some of this changed between OS X 10.1 and OS X 10.2.
 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
phoenix

External


Since: Nov 17, 2004
Posts: 1



(Msg. 5) Posted: Wed Nov 17, 2004 6:51 pm
Post subject: Re: How do I capture mouse movements... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi there,

Thanks for the response. I am specifically looking for a way to capture
strictly mouse movement events, with no buttons being pressed. I have
other things going on in the window (occasionally animation,
occasionally mouse clicks, and other things going on), so I can't call
any routines that block. From my reading of the TrackMouseXXX() calls,
it appears that these would block until a mouse event occurs. I will
have to try them to be sure my reading is correct.
So I came across the PPx::MouseMovedDoer mixin class, that should
capture the carbon mouse event(s) {kEventClassMouse, kEventMouseMoved}.
I wrote a sample window that just displays view that should change
colors when the mouse moves, if the event is captured. When I set a
breakpoint in my ::DoMouseMoved routine, the routine is never called.
Is there some sort of other setup that I need to do that will let my
view or window capture these events?

I will also mention that I have already successfully moved over much of
the window code to PPx, so I am at least familiar with the paradigm, if
not yet completely up to speed on some of the specifics.

Oh, I also have not been able to find any example code that captures
carbon mouse events (specifically kEventMouseMoved, kEventMouseEntered,
kEventMouseExited). Do you know of any?

Thanks,

---Phoenix...

David Phillip Oster wrote:


  >
  >
   >>Okay, So I am an experienced PowerPlant programmer. Recently I have
   >>been moving a decent sized gui project over to PPx. Many of the gui
   >>elements that I am working with (custom panes and views and such)
   >>require mouse tracking in the form of the old LMouseTracker
   >>class/LPane::MouseWithin. I was going to try to use an PPx::IdleTimer,
   >>essentially copying the behaviour of the LMouseTracker periodical, but
   >>the PPx::IdleTimer does not send a mouse event that I can work with. I
   >>then discovered PPx::MouseMovedDoer, but I never see the event get
   >>posted (my DoMouseMoved method never gets called). Other things I have
   >>tried have also proven fruitless. So how do I implement a non-blocking
   >>mouse tracker with PPx?
  >
  >
  > Mouse down or mouse up? Mouse down tracking loops generally bottom out
  > on either the system call TrackMouseLocation(),
  > TrackMouseLocationWithOptions(), or, more rarely, TrackMouseRegion()
  >
  > for mouse up tracking loops, be sure to read the "Mouse Events" section
  > of CarbonEvents.h. Note that CarbonEvents.h has changed since the old
  > "Universal Headers" days, so be sure you are looking at the copy of
  > CarbonEvents.h inside Carbon.framework (CarbonEvents.h is in
  > HIToolbox.framework, inside Carbon.framework).
  >
  > Once you understand what system calls are being called, then you search
  > the PPx source code and examples to see how connect through the PPx
  > layer to your code.
  >
  > Make sure you understand the difference between a
  >
  > kMouseTrackingMouseDragged and a kMouseTrackingMouseMoved, return values
  > from the TrackMouseXXX() system calls.
  >
  > and between a {kEventClassMouse, kEventMouseMoved} and
  > {kEventClassMouse, kEventMouseDragged} Carbon Event.
  >
  > Note that some of this changed between OS X 10.1 and OS X 10.2.
 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
Isaac Wankerl1

External


Since: Jun 25, 2004
Posts: 54



(Msg. 6) Posted: Wed Nov 17, 2004 11:40 pm
Post subject: Re: How do I capture mouse movements... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Phoenix <phoenix DeleteThis @cruzio.com> wrote:

 > Hi there,
 >
 > Thanks for the response. I am specifically looking for a way to capture
 > strictly mouse movement events, with no buttons being pressed. I have
 > other things going on in the window (occasionally animation,
 > occasionally mouse clicks, and other things going on), so I can't call
 > any routines that block. From my reading of the TrackMouseXXX() calls,
 > it appears that these would block until a mouse event occurs. I will
 > have to try them to be sure my reading is correct.
 > So I came across the PPx::MouseMovedDoer mixin class, that should
 > capture the carbon mouse event(s) {kEventClassMouse, kEventMouseMoved}.
 > I wrote a sample window that just displays view that should change
 > colors when the mouse moves, if the event is captured. When I set a
 > breakpoint in my ::DoMouseMoved routine, the routine is never called.
 > Is there some sort of other setup that I need to do that will let my
 > view or window capture these events?
 >
 > I will also mention that I have already successfully moved over much of
 > the window code to PPx, so I am at least familiar with the paradigm, if
 > not yet completely up to speed on some of the specifics.
 >
 > Oh, I also have not been able to find any example code that captures
 > carbon mouse events (specifically kEventMouseMoved, kEventMouseEntered,
 > kEventMouseExited). Do you know of any?

I can send you or post some code for a view that responds to the
MouseEntered and MouseExited events tomorrow. I'm still looking at an
issue where resizing the view doesn't update the mouse tracking region
correctly in certain situations. I will also look into the MouseMoved
events.

--
Isaac Wankerl
Metrowerks
 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
David Dunham

External


Since: Oct 12, 2003
Posts: 79



(Msg. 7) Posted: Sat Nov 27, 2004 2:39 pm
Post subject: Re: Popup that always sends message [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
,
David Phillip Oster <oster DeleteThis @ieee.org> wrote:

  > > My first thought was to avoid subclassing by creating an LAttachment,
  > > but there's no way for the attachment to send ClickSelf to make the
  > > tracking happen.
 >
 > Sure there is. Read LPane::Click() in LPane.cp. The attachment gets
 > called with an msg_Click message. If the attachment returns false, the
 > LPane's ClickSelf() is not called.
 >
 > ClickSelf is public, so the attachment can call it, THEN broadcast.

Hmm, I ended up subclassing so I don't have my attachment, but I could
have sworn I ran into problems with it not being public.

--
David Dunham A Sharp, LLC
<a rel="nofollow" style='text-decoration: none;' href="http://www.a-sharp.com/" target="_blank">http://www.a-sharp.com/</a>
"I say we should listen to the customers and give them what they want."
"What they want is better products for free." --Scott Adams
 >> Stay informed about: Popup that always sends message 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> -> Powerplant All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]