views:

41

answers:

1

I'm writing a mozilla plugin on the mac. I'm trying to capture events like button clicks, etc. I've done the normal thing of creating my views in inteface builder, and linking the sentActions to methods in my program. This works in stand-alone programs.

However, in my NPAPI plugin, those methods never get called. The button reacts, depresses, whatever, but it doesn't do its action.

Instead, the NPP_HandleEvent method gets called, but I never get the MouseDown or MouseUp event, only the UpdateEvt.

I set up the buttons to accept clicks via: (superview is the Mozilla view, topview is the top of my view hierarchy.)

[superView setNextResponder: topView]; [topView setNextResponder: nil]; [browserWindow makeFirstResponder: topView];

NEVER MIND: I'm an idiot. It IS calling the button sent actions. I was looking at the wrong method. That'll teach me to leave around a zoom: method when I'm actually using a doZoom: method... D'oh,.

+1  A: 

So, the problem was that I wasn't able to get buttons to work. The buttons were supposed to (for example) zoom an image in an IKImageView. (or rather, zoom the view). It didn't appear that it was working. The screen was flashing a lot, but nothing was happening... I put a printf in my zoom method, and it was NEVER GETTING CALLED! and so I asked the question.

Later, I noticed that I wasn't TRYING to call zoom, I was calling doZoom! doZoom WAS being called. And the reason that it wasn't zooming was an unrelated problem.

The problem ended up being that I was sending setImage to my IKImageView on every event, which re-set the view to 1-1, rightside up mode. Once I took out the extra setImage call, things started to work.

In the unlikely event that anyone else every experiences this, the answer is my cunning plan for world domination:

step 1: Don't be an idiot.

step 2: ???????

step 3: Dominate the world.

(If I could master step 1, I might just be able to figure out what step 2 was B-)

Brian Postow