Ok, I was able to answer my own question. Yes, one is capable of using
GEvent as an event manager for your javascript objects. I have
included a snippet of the code (below) that worked for me to
demonstrate what I mean. But a question remains: while I am capable of
using GEvent this way, is it appropriate? Maybe it is only intended
for use with Google Map objects... any advice before I start composing
more code with it?
Thanks, Rein
...
<script type="text/javascript">
function TestStateObject(){}
TestStateObject.prototype.checkClicked = function(e){
e = e || window.event;
var target = e.target || e.srcElement;
GEvent.trigger(this,"stateChanged",target);
};
TestStateObject.prototype.onStateChanged = function(src){
alert(src + " was changed to: " + src.checked);
};
TestStateObject.prototype.initialize = function(){
var input = document.createElement("input");
input.type = "checkbox";
input.onclick = this.checkClicked;
var label = document.createElement("label");
label.innerHTML = "sample property:";
document.body.appendChild(label);
document.body.appendChild(input);
GEvent.bind(input, "stateChanged", this, this.onStateChanged);
};
var testobject;
function main()
{
testobject = new TestStateObject();
testobject.initialize();
}
</script>
</head>
<body onload="main();">
...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---