On Mon, May 19, 2008 at 11:02 AM, Gilles Bassière
<[EMAIL PROTECTED]> wrote:
> Thanks for help. I haven't tried your solution yet but I think it does not
> suit my needs. If my understanding of events and MVC is good, the myAction()
> function would be executed when the WFS GetFeature response has been
> fetched, right ?

Yes, that's right.

> The logic of the WfsGetFeature button has two phases, first you select the
> tool then you select an area on the map. I actually need to perform some GUI
> actions when the button is clicked, before any request is sent. To sum up,
> I'm looking for a kind of onClick event attached to the button (though I'm
> not sure it's really mvc-friendly since no model is involved...)

You could either override doSelect of the button, or attach a listener
to the activate event on the button in that case, which has nothing to
do with Mapbuilder's MVC. Let's say your button has the id
"wfsGetFeature" in your config:

function onActivate() {
  alert("clicked");
}
config.objects.wfsGetFeature.control.events.register("activate", null,
onActivate);

This is an OpenLayers event, and the second parameter is the context
(note the different order of the parameters, compared to Mapbuilder's
addListener function).

> By the way, I'd like to ask another question. Your code example help me to
> understand events in an mvc architecture but i'm still get confused about
> "objref".What is the point on making a difference between "objRef" and
> "this" ? Or, what is the concept behind "objref" ? Sorry if this is a silly
> question but I'm not familiar with advanced architectures.

It's not a silly question, because both "this" and "objRef" are meant
to do the same. Mapbuilder uses an objRef argument to pass the
context, because at the time the Mapbuilder project was started, you
could not do function.bind in Javascript yet.

Regards,
Andreas.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mapbuilder-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users

Reply via email to