Questions tagged [eventhandler]

In object-oriented programming languages (such as C++, Lazarus Pascal or Visual Basic), visual objects (or components) can respond to *events* (usually) by the user. An event handler is the block of code that runs when an event occurs. Eg: *Onclick* event for a command button.

800 questions
14
votes
5 answers

Pass an Event to an iframe from the parent window? ( Javascript )

Before starting this question, i have to say I really searched everywhere to find the answer but nothing found. Also tried manythings like dispatchevent, postmessage, ... but nothing worked. Here is the case. I have a main windows, where I have 4…
Moha
  • 201
  • 1
  • 2
  • 7
13
votes
4 answers

Which C# pattern has better performance to avoid duplicated event handlers?

There are basically two patterns in avoiding duplicated registering of event handlers: (According to this discussion: C# pattern to prevent an event handler hooked twice) Using System.Linq namespace, and check if the event handler is registered by…
RainCast
  • 4,134
  • 7
  • 33
  • 47
13
votes
2 answers

JavaScript Event Listeners vs Event Handlers

Ok, I have been trying to figure this out for a long time now and finally have the time to investigate. As the title suggests "What is the difference"? I know that this works the way I want it to. addLoadEvent(converter); // Converter function…
Kevin
  • 25,946
  • 2
  • 19
  • 21
11
votes
3 answers

Event vs EventHandler

I read a lot of materials but I still did not understand, can someone explain me, please? What do I know: Declare an event: public event MyEvent myEvent; Vs. declare EventHandler: public EventHandler MyEventHandler; While EventHandler is a…
BIBI
  • 327
  • 1
  • 5
  • 15
7
votes
2 answers

Binding and event handler — passing the event object

I have some sample code which binds an event handler as follows: var h1=document.querySelector('h1'); h1.onclick=doit; function doit(x) { console.log(x); } When the event handler is triggered (by clicking on the h1 element), the output is…
Manngo
  • 14,066
  • 10
  • 88
  • 110
7
votes
2 answers

Mouse Event Properties are Undefined on IE 11

The following code I'm using to Identify the browser window close event and works as intended on other browsers but not on IE11. As this line of code gives me undefined only on IE11 alert(event.clientY+":"+event.clientX);.Can anyone please suggest a…
6
votes
1 answer

uwp page not firing keydown event at all

in my uwp app I just added a new page and navigated to it, and I have nothing on that page just the default grid. but I am trying to recieve keydown events which is not firing up by any key at all. I have also put keydown to the grid on xaml and to…
Muhammad Touseef
  • 4,357
  • 4
  • 31
  • 75
6
votes
1 answer

Do I have to remove the handler

the more I dig into C# and the GC I find more and more things I'm not quite sure about. I always thought that the Dispose and the respective Finalizer is only necessary when having some unmanaged resources in my classes. But I have many occasions…
msedi
  • 1,437
  • 15
  • 25
5
votes
2 answers

EditContext OnFieldChanged reporting wrong return type

I have the 3 methods below in a razor file protected override async Task OnInitializedAsync() { EditContext = new EditContext(_projectModel); EditContext.OnFieldChanged += EditContext_OnFieldChanged; } …
Baba
  • 2,059
  • 8
  • 48
  • 81
5
votes
3 answers

Problems with javascript event handler

I'm hoping this doesn't get marked as "duplicate", because I have reviewed several threads and followed the advice I found. I know I'm missing something simple, and need other eyes on this. I'm a newbie, so please bear with me. I am testing a…
Pops Jones
  • 113
  • 5
5
votes
2 answers

My class cannot be used as type parameter 'TEventArgs' in the generic type or method 'System.EventHandler' in .Net 4

I have trying to learn about EventHandler and I have to use a notification project. Here is the link of project : https://codeload.github.com/mike-eason/WPF_ToastNotifications/zip/master All I did is changing .Net-framework from 4.5 to 4 And I faced…
arna
  • 53
  • 5
5
votes
1 answer

Java: Allowing drop action in my inventory?

For my game I've implemented an inventory system. When the screen is clicked, a MousePressedEventis passed through all layers in the game, to all objects that inherit EventListener (My EventListener). The EventListener class works fine and, using it…
Kris Rice
  • 559
  • 1
  • 5
  • 23
5
votes
1 answer

Difference between HTML Event Handler vs DOM Level 0 Event Handler

Could someone please tell me what is the difference between the implementation of a HTML event handler versus a DOM Level 0 event handler in JavaScript?
Jonny
  • 59
  • 1
5
votes
0 answers

C# SystemEvents.PowerModeChanged fires too late

I want to catch the PowerModeChanged event before the computer or notebook is suspended. My code snippet is the following: void SystemEvents_OnPowerChanged(object sender, PowerModeChangedEventArgs e) { string fileName =…
Ismoh
  • 1,074
  • 2
  • 12
  • 35
5
votes
5 answers

JavaFX ContextMenu how do I get the clicked Object?

I am learning javafx.scene.control.ContextMenu, and right now I am facing a problem: how do I get the clicked Object from EventHandler? both event.source() and event.target() return the MenuItem. let me explain with an example: what should I write…
hanbin615
  • 575
  • 1
  • 5
  • 13
1
2 3
53 54