Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [event-handling]

Event handling is a coding pattern related to acting on messages between a source and one or more subscribers. A point listener in the source provides a way in which subscribed code can consume messages raised from the source.

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
0 answers
564 views

Simple, intuitive and (hopefully) safe EventDispatcher

For my own game engine I need an event system. I tried to avoid the single-huge-enum-approach for minimizing compile times. The BasicEventListener is the (...
Tim Diekmann's user avatar
6 votes
0 answers
79 views

FRP: Processing task lists

I recently heard about functional reactive programming and thought it was rather interesting. Therefore, I started out with writing a simple program which processes a list of tasks. (In this example, ...
APlessner's user avatar
5 votes
0 answers
2k views

C++ game engine event system implementation

I am currently working on the implementation of Event System on a game engine. I have zero experience in Event System implementation or the patterns that are used. What I have done is what I've seen ...
Kenny Wong KennyDBacon's user avatar
5 votes
0 answers
2k views

Reducing complexity in NSView event handling code in Swift

My Cocoa event code always tends to descend into madness, I need to advice on how to reduce complexity. I've spend a few hours putting this example together. CanvasView is a layer hosting subclass of ...
boyfarrell's user avatar
4 votes
0 answers
2k views

Mouse wheel scrolling for nested scrollable Swing components

By default, mouse wheel scrolling in Java Swing behaves differently than in web browsers. In Swing, when you have an inner scrollable component and an outer scrollable component, the mouse wheel ...
Roland Illig's user avatar
  • 21.3k
4 votes
0 answers
171 views

"Lock-free" one-shot event manager

Giving a review to Oachkatzl and recently about some other synchronization problems (Lazy with invalidate and some node-locking list), I wanted to test my skills and redesign it in most light-weight ...
user avatar
4 votes
0 answers
478 views

Media player subtitles in WPF - Part 2 Handlers and notifications

This is a continuation of Part 1. In this question I will present you with a single class which is the most crucial component of the whole system, it's responsible for firing notifications whenever a ...
Denis's user avatar
  • 8,478
4 votes
0 answers
84 views

Comparison of sprite movement implementations

I've come up with two ways to do sprite movement with CreateJS, and I'm wondering if one is better than the other as far as performance and maintainability. The player data is saved in a json file ...
Big McLargeHuge's user avatar
4 votes
0 answers
1k views

Anonymous Events in Delphi

I wrote a anonymous event creator. I would like to ask if anyone can tell me if I did it the "right" or "best" way, or how I could make it better. Here is what I did: Declaration: ...
linluk's user avatar
  • 315
3 votes
0 answers
270 views

A Compile-time templated event system and dispatch manager

Problem I would like to make an efficient, extensible, and potentially asynchronous parallelizable event system using modern features in C++20. My solution I've constructed a templated event struct by ...
Robbie's user avatar
  • 131
3 votes
0 answers
67 views

Javascript Call To Action Modal

I created a simple modal that when a user scrolls down a blog post, a modal pops up. If the user wants to sign up for newsletter, then a form pops up. The only external library I used was body-scroll-...
Mox's user avatar
  • 267
3 votes
0 answers
347 views

C++ Generic Action Dispatching & Handling System

I am trying to achieve an event system, which I refer as actions, and would like your ideas about what I come up with so far. I have made research on several design patterns, and several systems used ...
Inan Evin's user avatar
3 votes
0 answers
486 views

Media player in WPF - Event binding

I recently started making a media player, this is the first time I'm using WPF and I found that most project are utilizing the MVVM architectural pattern, I haven't used that one either but I decided ...
Denis's user avatar
  • 8,478
3 votes
0 answers
266 views

Search GitHub users when text field changes in Kotlin Android app

Problem: Search for users by their name using the GitHub API (sorted by the number of followers) and display the results in a RecyclerView. Implementation: Hitting the GitHub API every time when user ...
Ankur_009's user avatar
  • 131
3 votes
0 answers
73 views

Creating an observable stream of clicks and converting it to an iterator

Problem 1 StratifiedJS allows people to cleanly create observable streams using the Stream class from sjs:sequence: ...
zamfofex's user avatar
  • 131
3 votes
0 answers
165 views

Adding swipe support to multiple classes

I have implemented swipe functionality using UIPanGestureRecognizer in a project. What I have done is added PanGesture to ...
LC 웃's user avatar
  • 143
3 votes
0 answers
46 views

Simple gallery with scroll

I just created a simple gallery with scroll. Everything works fine but I'm not sure how should I optimize this code: ...
pastuszkam's user avatar
3 votes
0 answers
861 views

C++ Event Emitter

I needed an event bus in C++ with a few features: Possibility to add/remove both functions and member methods. Ability to remove automatically those listeners that wrap member methods of expired ...
skypjack's user avatar
  • 131
3 votes
0 answers
44 views

Periodically monitor if record is not updated using Node, Event and setTimeOut

Here is my scenario: Every user checks in every five minutes. If some user doesn't check in after 5 minutes, I should be able to keep track of it. If some user doesn't check in N number of times, an ...
Jay's user avatar
  • 131
3 votes
0 answers
124 views

Encapsulating behavior spread across multiple event handlers

I wrote a chatbot in Ruby for turntable.fm, a chatroom where users can listen to music together. It interacts with users in a room, who can type in specific keywords and get responses from it. It also ...
Kevin's user avatar
  • 133
2 votes
0 answers
71 views

To-do list application

I use a lot of for loops and I think it slows the code down a lot but I have no idea how else this code could be written. Its for a to-do list app and each ...
Helan's user avatar
  • 21
2 votes
0 answers
1k views

Simple event broker / eventbus in C# (~100 lines of code)

Background I was looking for a simple Event Broker or EventBus (whatever else keyword you can come up with) to use in a small(-...
Dmitry Avtonomov's user avatar
2 votes
0 answers
1k views

JavaScript: implement event listener in custom object

For many years, there have been several JavaScript libraries for implementing custom events and event listeners. But, as MDN web docs suggests, there are now available constructable Event, CustomEvent ...
Passiday's user avatar
  • 121
2 votes
0 answers
535 views

Angular 8: Scroll spy implementation for a timeline Contents

I have made a timeline component that can have multiple milestone/major/minor as sub components nested within timeline container component. I have also added a side navigation for that lists all ...
Velen Aranha's user avatar
2 votes
0 answers
6k views

Event management system in C++

I have this question asked as home assignment for an interview. I submitted my solution and did not get selected. Wanted to know your feedback for the solution. Question: Write a very simple ...
ksh's user avatar
  • 21
2 votes
0 answers
27 views

UI Event Flow class

Purpose: I wanted a way to improve event clarity and event code organization. I observed that every single event flow went through the following steps: Trigger -> UI Change -> (Async) ...
Shelby115's user avatar
  • 1,961
2 votes
0 answers
149 views

Observer(Event) system (Signals and Slots), type and template based

Signals are represented as types. You can connect a member function of some instance to the Observer system. This connected function will be called whenever a signal of a type that is the same type as ...
Darius Duesentrieb's user avatar
2 votes
0 answers
1k views

PyQt frame which changes color with child focus

I am working on an application that has various "panels" contained within splitters. I wanted the panel border to change color when one of it's children gained focus. Here is a simple example of the ...
Spencer's user avatar
  • 261
2 votes
0 answers
51 views

Event handler re-use in Javascript

I've been trying to deal with a lot of duplicate code in the first web pages I've been working on and have been playing around with the prototype model, which I think is the 'right' way to go about it....
S Meredith's user avatar
2 votes
0 answers
28 views

Event based read and output file lines

In the near future, the app will have to start several actions after having read the content of the file (executing request based on the request module). I was ...
Quentin's user avatar
  • 121
2 votes
0 answers
62 views

Two similar methods to re-create objects and emit events

I have these two methods basically doing the same thing: ...
StudioWorks's user avatar
2 votes
0 answers
2k views

Simple event handling system

I have written a simple event handling system, which is intended for a game but right now I am just trying to get a general framework created. This is simply for practice for myself, but I am trying ...
Dord's user avatar
  • 21
2 votes
0 answers
55 views

Custom event trigger and listener module

I am working on a data collection JavaScript library, and would like other members of my organization to be able to write loosely coupled plugins to extend its core functionality. I've been working on ...
Jeremy H.'s user avatar
  • 141
2 votes
0 answers
254 views

Generating a carousel slider

I'm currently using Backbone to generate a carousel slider. In my View, I have an initialize function that looks like this: <...
DaveyJake's user avatar
  • 121
2 votes
0 answers
457 views

Swing keybinding to control an animated car

In my textbook there is no mention of keybindings and it encourages the use of keylistener so there isn't any example code using keybindings for its problems. I was wondering if this is sorta close to ...
Legate's user avatar
  • 147
2 votes
0 answers
412 views

Event Service in c++

I'm interested in receiving some feedback regarding an Event system that I wrote. Both in style and implementation, but also in overall design and the design decisions that I made. It is intended to ...
OnePie's user avatar
  • 211
2 votes
0 answers
234 views

Event Delegates using IIFE or Module

I am learning jQuery/JavaScript best practices and am attempting to put them into practice. My overall goal is to have lots of small, independent .js files which contain specific functionality and ...
user avatar
2 votes
0 answers
66 views

Alternative to clicklistener inside an anonymous class

For a trivial word game, I wrote the following code for the player to choose one of the two choices of words that in turn were read from a sentence. My question lies in first in the click-listener of ...
Josef Young's user avatar
2 votes
0 answers
297 views

handle drag and drop operations

I've come up with the following code to handle drag and drop operation. It's composed of a constructor function that returns an objects with methods to attach to event handlers. Notes about this ...
André Werlang's user avatar
1 vote
1 answer
87 views

A Windows localhost key logger in C++ with WinAPI

Now I have this repository. It's a key logger logging all the keyboard events possible. Note that some programs do not "leak" the keyboard events outside of their GUI. For example, Notepad++ ...
coderodde's user avatar
  • 28.4k
1 vote
0 answers
43 views

A JavaFX program to find out the mouse refresh rate v3

(This post is the continuation of A JavaFX program to find out the mouse refresh rate v2.) After taking @J_H's suggestions into account, I ended up here: ...
coderodde's user avatar
  • 28.4k
1 vote
0 answers
22 views

Event system in react

What I Want? I want to make an event system in React that cuts back on unnecessary re-renders and stops props drilling. What I Did? The code I came up with is the following: ...
workoverflow's user avatar
1 vote
0 answers
59 views

Basic Event Cancellation

I recently came across the need to allow consumers to prevent further execution of methods and I utilized an event driven system that allows the consumer to specify if the execution should cancel. I'...
Hazel へいぜる's user avatar
1 vote
0 answers
55 views

Dynamic adding and removing div elements using event streams (eventlistners)

I has div block feedList which contains feedItems. Now to fill ...
Gudsaf's user avatar
  • 186
1 vote
0 answers
110 views

How to refactor below nodejs code to unblock event-loop?

I produced below code and soon it became outdated due to the blocking nature of it's loops which I can't see how to avoid that. Work-flow summery Client send a request to "/" to get a list of JS ...
inckka's user avatar
  • 119
1 vote
0 answers
74 views

AIPlaylist: Adaptive media player using VLCJ and Swing

I created a project using VLCJ and a probability function to create a media player that plays your favorite media more often than the others, because I wanted to hear my favorite music and videos more ...
Al G Johnston's user avatar
1 vote
0 answers
59 views

Repetitive code for an event listener

So I'm using the event emitter as some sort of an event bus(If I'm allowed to call it that). The problem I've stumbled upon is that my listeners might want different data than another listener. Since ...
mertje's user avatar
  • 153
1 vote
0 answers
25 views

Creating a reusable plugin (Dialog/Notifier as example)

I started working on a notification system that is pluggable into any project. I have not made any "plugin" type javascript libraries, usually just functions very specific to the project at hand. That ...
darcher's user avatar
  • 724
1 vote
0 answers
93 views

ReactJS code that allows at most one profile pic to be selected

I am making a profile picture selection screen, basically you select a picture pic1, if another picture pic2 is selected, then we cancel the highlight of pic2 and highlight pic1. Here is my code right ...
Acy's user avatar
  • 111
1 vote
0 answers
195 views

Golang message bus for a game engine

I wrote a memory bus struct in golang to allow systems to interact with each other without knowing anything about the receiver. This is for a game engine. I know it's not good to write games in ...
TotallyGamerJet's user avatar