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.
eventhandler
818
questions
15
votes
3
answers
15k
views
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 ...
15
votes
5
answers
28k
views
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 ...
13
votes
4
answers
3k
views
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, ...
13
votes
2
answers
11k
views
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.
...
8
votes
2
answers
6k
views
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 ...
7
votes
1
answer
3k
views
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 ...
7
votes
2
answers
6k
views
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....
6
votes
5
answers
7k
views
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.
...
6
votes
1
answer
1k
views
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 ...
6
votes
0
answers
425
views
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)...
5
votes
3
answers
971
views
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 ...
5
votes
2
answers
2k
views
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 += ...
5
votes
2
answers
4k
views
Using showAndWait in the onFinished EventHandler of an Animation doesn't work
In JavaFx, I want to show a modal dialog after an animation ends. For some reason, calling showAndWait in the EventHandler that gets executed after the animation ends doesn't work. A new window is ...
5
votes
2
answers
2k
views
My class cannot be used as type parameter 'TEventArgs' in the generic type or method 'System.EventHandler<TEventArgs>' 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 ...
5
votes
1
answer
173
views
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). ...