PDA

View Full Version : Question Regarding Mouse Down



g2fly
7 Oct 2015, 8:57 AM
I am having an issue with passing a needed variable in the new component class. The problem is when the spinup is clicked, the class is called again and the current_cursor_position is set back to 145. I have not found of another way to register a mouse down click. Any recommendations?


current_cursor_position: 145, //global variable

init{
this.getView().addListener('spinup', this.spinnerUp, this);

this.getView().mon(this.getView().getEl(), {
mousedown: function(e) {

//logic to find user current mouse click...I need to store this so spinnerUp can use the variable
}
},

spinnerUp {
spinnerUp = //recorded cursor position

//logic to increment time
}

tristan.lee
9 Oct 2015, 9:48 AM
Can you provide a fiddle (https://fiddle.sencha.com) demonstrating the issue so I can work with you on resolving this?

g2fly
9 Oct 2015, 1:10 PM
I found a solution to this issue. I was using the wrong function mon wrong and losing scope. the syntax should be .mon(myButton, 'mousedown', myFunction, this)

g2fly
9 Oct 2015, 1:11 PM
Though could you help me with how to move the cursor position? I can get it but I can't move it after I preform the event spin up

tristan.lee
12 Oct 2015, 12:10 PM
Are you trying to move the mouse cursor to a different location, or the caret within a textfield? If you can provide code to give me context, it will be a bit more helpful.