event-handling

Binding and triggering native and custom events in Prototype

*爱你&永不变心* 提交于 2019-12-13 00:47:52
问题 I'm having a bit of issue with events in prototype. I'm trying to bind and fire the native events: onhashchange , and onpopstate . As well as my custom events: statechange and anchorchange . All these events are for the window element. Here's the code I've already tried with no luck: Element.observe(window,eventName,eventHandler); Element.fire(window,eventName); Any help would be appreciated. 回答1: You can only use fire for custom events. Take a look at this question/answer. I think it solves

Using KeyListener with Java

筅森魡賤 提交于 2019-12-13 00:39:03
问题 For a homework assignment I need to create a program that essentially displays a ball and the user should be able to move it using the left and right keys. However, the program isn't responding to the keys. I don't know where the bug is, and I'd appreciate it very much if someone could help! This is the code: public class GraphicsComponent extends JComponent { Ellipse2D.Double ball = new Ellipse2D.Double(200, 400, 80, 80); public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)

as3 event handling

自古美人都是妖i 提交于 2019-12-13 00:36:46
问题 I've got strange problem with Event handling in AS3. I've got two classes: public class Configurator extends Sprite { public function Configurator () { this.addEventListener(FramedPhoto.FRAMED_PHOTO_LOADED, this._test); var fp = new FramedPhoto(); } protected function _test(event:Event) { trace('_test()'); } } and the second one: public class FramedPhoto extends Sprite { public static const FRAMED_PHOTO_LOADED = 'framedPhotoLoaded'; public function FramedPhoto () { trace('FramedPhoto()');

jQuery - How to remove event handler only while an animation or function is running?

痴心易碎 提交于 2019-12-12 23:51:34
问题 I am attempting to create an image gallery. At the bottom I have a strip of thumbnails these thumbnails slide left and right when you click an arrow but if you click the arrow multiple times it ques the function. I would like to remove the click handler while the function is run, then replace it again. On a side note, my thumbnail scroller uses margin-left to animate, is it possible to use scrollTo or similar, to move an element a specific amount, horizontally, so if the thumbnails change

ZF2 - How to Listen for Events and Trigger a Service because of it?

家住魔仙堡 提交于 2019-12-12 20:44:54
问题 Have been trying to learn how to implement Services because they get Triggered by a Listener. Have been doing a serious lot of reading the last few days to get it to work, but have been finding it difficult. Thus I'm thinking my understanding of the order of things might be flawed. The use case I'm trying to get to work is the following : Just before an Address Entity (with Doctrine, but that's not important) gets saved (flushed), a Service must be triggered to check if the Coordinates for

Is it safe to use the same event handler for different Windows Forms Controls?

元气小坏坏 提交于 2019-12-12 18:34:10
问题 Is this good practise? I have 3 DataGridView's and I want to have a facility that allows a user to sort the data by clicking on a column header. I could've had an event handler for the ColumnHeaderMouseClick event for each of these DataGridView's, but instead I made one: private void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { SortDataGridView((sender as DataGridView), e.ColumnIndex); } SortDataGridView looks like this: /// <summary> /// Sorts a

CheckedChanged EventHandler of dynamically added Checkboxes not firing inside UpdatePanel of a Repeater

我们两清 提交于 2019-12-12 17:17:33
问题 I´ve read most posts here but i can´t figure out why the "CheckedChanged" Event is not firing. Here is my situation. I´m using a Repeater to generate Items out of a Database. Each ReapeaterItem should include an UpdatePanel, because i have to Update the Controls inside the UpdatePanel and do not want to reload the complete page. Inside these dynamically generated UpdatePanels (each RepeaterItem has one) i´m adding up to three Checkboxes dynamically (based on the Database). These Checkboxes

Normalizing the CodeMirror OnKeyEvent with jQuery

爱⌒轻易说出口 提交于 2019-12-12 16:15:15
问题 I'm using CodeMirror along with jQuery to provide syntax highlighting on a pet PoC project. It's been doing great, until I realized that CodeMirror seems to be capturing key press events on the DOM in such a way that it stops global application hotkeys from working when I'm currently typing into a CM-enabled textarea. For simplicity's sake, let's assume that I have the following listener on my page: var hotkey = function (e) { if (e.shiftKey) { alert('foo'); } }; $(document).keypress(hotkey);

How to remove d3.behavior.drag().on(“drag”,…) event handler [duplicate]

久未见 提交于 2019-12-12 16:10:36
问题 This question already has answers here : D3.js: Remove force.drag from a selection (3 answers) Closed 3 years ago . I have the following attached to a svg element var dragger = d3.behavior.drag() .origin(function(d) { return d; }) .on('drag', this.move) .on('dragend', dropHandler); //caller var g = c.append('svg').call(dragger).data([{ x: x0, y: y0 }]); I am implementing some code inside the dropHandler function that needs it's own implementation of .on("drag",..). How do I remove the

Changing a Label when a Bool variable turns True

白昼怎懂夜的黑 提交于 2019-12-12 15:17:08
问题 i'm not really sure how to explain this... i'm going to put the code in psuedo code for easy reading pretty much I want a label to change it's text when a bool variable of a class changes... i'm not sure what I need to use since i'm using WPF and the class can't just change the label i don't think? do i need some sort of event? or a WPF event? thanks for any help public MainWindow() { SomeClass temp = new SomeClass(); void ButtonClick(sender, EventArgs e) { if (temp.Authenticate) label