Login Register

how to dijit.form.Button onMouseOver

i tried to

dojo.addOnLoad(function() {
var btn=new dijit.form.Button(
{id: "btn_1",label: "hello" ,onMouseOver: myMouseOver},dojo.byId("btn_1"));
});

but it didnt work if i change it to OnClick it does. what am i doing wrong?

another question why it's override the OnClick behavior, do i need to use dojo.connect instead?

nothing

Please post support questions to Dijit Support forum.

You aren't doing anything wrong, it's just not supported. You could dojo.connect() to btn.domNode if you want (but I'd recommend onMouseEnter not onMouseOver).

> another question why it's override the OnClick behavior, do i need to use dojo.connect instead?

For onClick() it's OK to override the onClick behavior because onClick() is an empty method.

=========
Bill Keese
Project Lead (aka BDFL) of Dijit

See api docs

There is no onMouseOver named method: http://api.dojotoolkit.org/jsdoc/dijit/HEAD/dijit.form.Button
There _is a private _onMouse method, which you should read carefully before you override. Depending on what you're trying to achieve, perhaps the best approach would be to

dojo.connect(
  btnWidget, 
  "_onMouse", 
  dojo.hitch(
    btnWidget, 
    function(e) { 
      if(this._hovering) { // do your stuff here }
    }
  )
)