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.

Filter by
Sorted by
Tagged with
3
votes
2answers
216 views

Simple event mechanism

I am working on a simple event mechanism for c++. Since Iam not very experienced I would like to share my code in order to get some thoughts. I also dont like the BIND_X macros. Ideas how to ...
3
votes
1answer
69 views

Toggle Event Delegation

NOTE: the Javascript is all I'm concerned about, the HTML/CSS is just DEMO code. One caveat is ARIA states or attributes, if you have input on that, by all means, dive in. I had the need for and ...
3
votes
0answers
218 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 ...
2
votes
2answers
8k views

Form for OTP entry with six single-character text fields

I am working on an app in which I have to pass 6 digits OTP through 6 textFields in which you to provide only one character and after that it automatically goes to ...
1
vote
1answer
368 views

Event Handling Gamepad in Java

Context This program will control a robot. It is written in Java 7 and compiles into an Android app, but these classes are not Android specific. This program was written for FIRST Tech Challenge and ...
5
votes
0answers
1k 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 ...
0
votes
1answer
125 views

Double loop for input handling

I'm writing a simple game with multiplayer mode in C++, using the SFML framework. Since I don't want to make it more complicated than necessary, I handle everything on a single thread, so that when ...
0
votes
1answer
31 views

Activate submit button on form change and detach event listener

We have pages that contain 1-3 forms. Each form does have a submit button which is styled as inactive* as long as the user didn't change the form. Now I need to: remove the class from the button as ...
4
votes
1answer
101 views

Simple C++98 actor system (with event system) - think Doom or Unreal

I am finishing up an actor system (like those used in 90s games, like Doom, Unreal, etc.), which currently deals with damage and event handling. actor.cpp ...
2
votes
1answer
72 views

Throttle redraw requests fired from pointer events

I am working on a photo editor, which displays a preview to the user on a canvas. At various points in the app, the user may use sliders to adjust properties of the photo, such as scaling, rotation, ...
3
votes
2answers
125 views

Calculate the heat flow (for radiators)

I´m a programing rookie with minor javascript skills. So I ask you for a code review since I'm not sure whether my code is ok. Short explanation of my program: I work for the heating industry. ...
5
votes
2answers
129 views

Event emitter npm module

I was asked to complete the task described below: Event Emitters are objects that serve as the core building block in event-driven architectures. They simplify the process of handling asynchronous ...
0
votes
1answer
40 views

Manager that collects and handles multiple tasks that run on events like window.scroll, window.resize etc

I'm working on a website where different things can occur on resize and scroll events. I only want one event handler that comes ...
3
votes
2answers
110 views

Subscribe to Event form one service to another

In my architecture I have service layer, and for my question two relevant classes in this layer: UserManagementService EmailSenderService In first service there is method: ...
9
votes
1answer
21k views

Angular directive to disable a button when clicked, allowing re-enabling as needed

I have written an Angular Directive that disables a button after it has been clicked, to prevent double posting / saving of data. This works fine in most of our use cases. However, in some situation ...
1
vote
0answers
54 views

Message loop handler functions, using associative array and using switch

I am using the Windows API to register system-wide hotkeys. This requires a message loop to be created, and a handler to handle the hotkey messages. I have written two pieces of functioning code. The ...
2
votes
1answer
103 views

To Do List using basic JS

I learned javascript from some tutorials and as per advice, I thought of creating some task by my self. I wrote the following code and as I expected I saw the answer. If someone can assist me with how ...
4
votes
1answer
2k views

Simple event dispatcher

Here is my very first event dispatcher. I would like to get both, style and code review, as well as some ideas to improve this implementation (new features etc.) I tried to write code in C++17 style ...
1
vote
2answers
41 views

Click a link to delete targeted content using Ajax

I used a glyphicon as a link to delete a comment: ...
3
votes
1answer
66 views

Lightweight Java Event Handling Interface

I've been looking for a simple way to manage event passing between classes and, like many others, have found the whole addXxxxListener paradigm to be tedious and ...
1
vote
0answers
389 views

Using postMessage() in JavaScript with iframes for cross domain communication

I am trying to enable communication via JavaScript from an iframe and its parent window when they are on different domains. I did a lot of research and it turned out that ...
1
vote
1answer
198 views

JavaScript debounce function

I built one JavaScript debounce function. I need a JavaScript expert's opinion if this is the correct way to do it, and if not, then what the flaw is in this current function. ...
2
votes
0answers
976 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 ...
3
votes
1answer
70 views

on() event handler for multiple objects [closed]

I'm using three instances of ace editor in a form. I initialize them like so: ...
0
votes
2answers
2k views

Handling keyup events with throttle or debounce in Javascript/jQuery

In my web application, there is a search input field, and when the user empties all of the text inside the input field, there is an API call made for a default-list of results, which are displayed in ...
2
votes
2answers
113 views

Manipulating the browser history

I created a table with the ability to edit with popup. This part of the code, which includes: the ability to send URL to other users with the subsequent opening of the same state (the popup window ...
4
votes
0answers
346 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 ...
5
votes
2answers
1k views

One more C++ event system

This is an event system implementation for C++. GitHub I'm targeted on following features: RAII-friendly any number of event parameters ability to use member functions, free functions and lambdas ...
1
vote
2answers
605 views

C# style Event and Delegate in C++

I'd appreciate advice regarding both the implementation detail and ways to improve usage/performance/generic. There are two parts: XDelegate, which is I got from ...
6
votes
2answers
34k views

Binding a keyboard key to a Tkinter button

I'm specifically asking about binding a keyboard keystroke to a button in a GUI. Originally I planned to bind the keystroke to the GUI button itself, but that seemed impossible, and potentially unwise ...
0
votes
2answers
92 views

Attaching a click handler in a cross-browser way

I have been attempting to have a method call, with a parameter, inside of a ternary operator to simplify some code. Code: ...
1
vote
1answer
160 views

Custom observable types and their supporting classes

I decided that for some parts of my project, communication through events would be very handy, for that purpose I started writing the most basic part of the event system, an interface consisting of ...
5
votes
1answer
1k views

JavaScript quiz game

Here is the JavaScript code: ...
5
votes
1answer
1k views

Complete ObservableDictionary

In conjunction with a recent question of mine, I found that an ObservableDictionary would be very handy for my situation, so I decided to implement one. I've ...
2
votes
1answer
18k views

onChange vs onKeyPress for input in React

I have an input form, and when you press enter I want it to call a function. I was wondering what "the right" way of doing this is. Right now I have an input looking like this: ...
6
votes
1answer
310 views

Simple color clicker game

My friend recently made a color clicker game, and I tried cleaning up the code a bit. I want to know how I can improve the functions and passing/editing of global variables. There are a lot of ...
4
votes
1answer
253 views

A C#-style Event object in C++

I wanted to make an Event object (similar to C# events) for use with a custom UI I'm writing. The Event should allow multiple consumers (observers) to attach to any given event and not leave dangling ...
1
vote
0answers
39 views

Competent addition of events in JavaScript

I want to write my own library. The main class in it is Event. It performs a lot of hard work. I want to make it so that the programmer, using this library, could ...
6
votes
1answer
2k views

Simple implementation of signals and slots mechanism using templates

I tried to implement a simple signal&slots mechanism for some DSP software that runs on embedded Linux. I would like if somebody can review this code and give me some guidelines. Any review and ...
1
vote
0answers
1k views

Autosave reactive forms

I'm building an autosave for a data driven form on Angular. Here is our code snippet: ...
0
votes
1answer
43 views

Mark a radio element as selected on page load and when clicked

I have the following javascript that calls a function on page load and on click of an element on my page. Is this the cleanest way to do this? ...
2
votes
2answers
338 views

addEventListener after fetched data

This is working code, but I want to simplify, correct, and improve the code. ...
1
vote
1answer
202 views

Async database helper function in TypeScript

I have made an async function in TypeScript that responds to Events and returns an object with methods that return a promise. I ...
1
vote
3answers
1k views

Hide or show table rows as a hierarchy

I'm using PHP HTML and JavaScript to write questions that need to be shown/hidden based on inputs from the user. I have several rows in a table, each row contains a ...
1
vote
1answer
93 views

Emit different text and sound when each of three buttons is pressed

I would like to use this same code on multiple pages of photos (to help my son recognize people). So instead of reinserting the name of each person, I created the ...
0
votes
2answers
54 views

Note which colour button was clicked

I have a script that changes the colour, it selects the colour by the id, then it listens what colour was clicked, and if the colour choose was black or whatever other colours, it will do the job. ...
7
votes
1answer
122 views

First Javascript program - Snakes game on HTML canvas

I'm relatively new to programming but my most familiar languages are Java, C# and Haskell and this is my first javascript program. All the concepts used in here were just the first thing that came to ...
9
votes
3answers
661 views

Carousel in Vanilla JavaScript

I finally got my carousel to work in JavaScript, and I want to know what you guys think about it and what I can do better. ...
0
votes
4answers
226 views

Three clickable navigation elements, where only one should be active

I have three clickable <h1> elements in the nav bar of a static page I'm making as a practice project. I wrote code so when I click one, it lights up. Since ...
2
votes
1answer
498 views

GLFW simple event handler

I wrote a simple concept of an event system in cpp. It is uses a namespace and a global state, but normally a global state with namespaces is bad practice. Is there a better way to do simple event ...

1 2
3
4 5
9