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.
40 questions
5
votes
2
answers
162
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
...
4
votes
1
answer
257
views
Improved Event System & InputManager Using C++
I am new to C++, so please take me easy. I want to make a low-level game engine only using C++, OpenGL and GLFW. This is a continuation of Event System using C++ ; I added the suggestions from there. ...
3
votes
2
answers
3k
views
Event System using C++
I am excited to share that I have developed an event system in C++. I have always been passionate about programming and have long aspired to create a low-level game engine solely using C++, OpenGL, ...
3
votes
1
answer
67
views
A JavaFX program to find out the mouse refresh rate v2
(See the continuation of this post in A JavaFX program to find out the mouse refresh rate v3.)
(This post is a continuation of A JavaFX program to find out the mouse refresh rate.)
After adopting the ...
19
votes
5
answers
7k
views
Using sounds in Java
I'm trying to apply sound today, and the goal in mind was a simple violin tuner. The actionListener seems repetitive/ How might I optimize it (what I tried just ...
18
votes
2
answers
4k
views
Using events together with interfaces in VBA
Introduction
Because of the limitation of VBA in using events in interfaces I was searching for a kind of workaround.
For sure I also read this which also provides an approach, but I was searching for ...
12
votes
1
answer
485
views
Resizable containers with VueJS
A month ago I reviewed the code in Resizable split DIVs Vue.js, suggesting that the OP use computed properties and bound styles to simplify the code (at least reducing the need to use ...
10
votes
1
answer
699
views
Finger painting code
I have a very simple view that handles touch events and draws accordingly. It's nothing significant, but it does use a bit more CPU than I would like (35%). Again, it is the bare minimum (<90 lines)...
9
votes
2
answers
720
views
Animated Calendar using HTML + CSS + JS
I'm a beginner developer and I'm building a calendar for smartphones. I'm using HTML, CSS and JS. I'm not entirely done with the project yet, however, I have the feeling that I'm making a messy code. ...
9
votes
3
answers
800
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.
...
8
votes
1
answer
2k
views
How can I condense several IBAction methods in a class with a delegate?
I have the following class:
MyProtocolClass.h
...
8
votes
1
answer
2k
views
C++ Event System - Game Engine
Introduction
I have just started learning templates and experimenting with function pointers. I wanted to create an event system that met a couple of goals:
Event types are PODs, and do not inherit ...
8
votes
2
answers
3k
views
Overriding all Access form control AfterUpdate methods
I have a set of custom event handlers for all my textboxes and combo boxes. The reason for this is my users want the bound form (to SQL Server) to immediately push changes to the recordset, rather ...
7
votes
1
answer
430
views
Threadsafe oneshot-event which fires on subscription if the event was fired in the past
Assumptions
Basically, a Connection class has a "Disconnect" event. Subscribing to this event isn't thread-safe, because the disconnection may fire from another thread right before I subscribe. So ...
7
votes
1
answer
204
views
My EventBus system
I decided to roll out my own EventBus system which is intended to be thread-safe.
Hence a review should focus extra on thread safety apart from all regular concerns.
The ...
7
votes
2
answers
258
views
eCommerce Mockup App in JS
I have completed this mockup eCommerce app using Javascript. This version can add products into a shopping cart and automatically calculate the order summary in the shopping cart. It can also delete ...
6
votes
1
answer
578
views
Resizable split DIVs Vue.js
I just started Developing Web App (Vue.js) for my company for around 1-2 months. Therefore, my knowledge and experience in HTML, CSS and Javascript is kinda shallow.
I've created a custom resizable ...
6
votes
1
answer
3k
views
Navigation bar built from fetched JSON data
I have finally been able to create my little navigation plugin in an object-oriented way that reads the li from a JSON file.
Now, is my code efficient? Especially, ...
5
votes
1
answer
2k
views
Copy Cell on Worksheet_Change event if some criteria is met
This code is working fine, but it looks awful (yes, I am a rookie on this thing). How can I improve it to look better?
...
5
votes
3
answers
2k
views
Subscribing an Object to its own Events
Is it appropriate for the class to subscribe to its own events like this? Should the class not subscribe, and instead move that code to before the ...
5
votes
1
answer
356
views
Two keyboard handlers for a video game character
The code below is equivalent. I can see pros and cons for both versions. Which is better: the short, clever way, or the long, ctrl+c way?
Short version:
...
4
votes
0
answers
175
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 ...
4
votes
2
answers
287
views
A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support
(See the follow-up question.)
I have this program that shows a small window and that window shows a rectangle whose color is the same as the color of the pixel under the mouse cursor. Note that it ...
4
votes
0
answers
488
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 ...
4
votes
1
answer
73
views
Style-changing handler for an HTML drop-down box
How can I maybe do some loop that will compress the amount of JavaScript/jQuery I need to use. I have a function s3episodesChange() linked to a ...
4
votes
2
answers
91
views
Initializing events on class
I wrote a simple class that substitutes all file inputs in an HTML for a more complex template and set some actions on it. The code is rather small, but I'm not used to write JavaScript.
I wonder if ...
4
votes
2
answers
1k
views
Get array of pressed buttons using extension method
In my game, I need to detect whether any buttons/keys are pressed at all before I try to process any input. This is easy enough for keys since the XNA library provides a ...
3
votes
2
answers
90
views
Limit second <select> options based on the first <select>
I want to see if there's a better way to write this code, solely in Javascript.
There are two kinds of sets, the first set (C7, T7, C11, T11) have four options in the first select, and then up to two ...
3
votes
2
answers
936
views
jQuery dynamic toggle class function
I wrote this function that will toggle a class of a targeted element. Applying the class js_class_toggle to any element will trigger the function when clicking on ...
3
votes
1
answer
2k
views
Unit-testing event aggregator
I have written event aggregator with the following API (just for the fun of it, I am aware that nuget has like 100 similar implementations):
...
2
votes
1
answer
1k
views
MVVM implementation using C# and XAML
I have used INotifyPropertyChanged for both Model and ViewModel. Is it correct?
First of all I was trying to use ...
2
votes
1
answer
320
views
To-do app front-end in Vue 3
I have put together a To-do Application with the Slim framework on the back-end (API) and a Vue 3 front-end. I added a demo on my YouTube channel.
In the main App.vue file I have:
...
2
votes
1
answer
86
views
A JavaFX program to find out the mouse refresh rate
(See the next version here.)
Intro
I have this tiny JavaFX program that shows a 800x600 pixel canvas. You are supposed to drag the mouse within the canvas. When you are done dragging, the program will ...
2
votes
1
answer
398
views
Truncate text to some number of words when clicked
I am currently using the code below to truncate text:
...
1
vote
1
answer
672
views
C# Events in a Tic Tac Toe game
I am new to coding and am trying to understand events what is an annoying stage but super important I guess. I just made a Tic Tac Toe game and it is working but not really "beautiful" coded. I really ...
1
vote
0
answers
50
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:
...
1
vote
1
answer
163
views
Showing form on btn click - preventDefault of submit btn, then remove listener
I've built out a section on a page that contains multiple instances (why I'm using querySelectorAll()) of this Request Brochure form. They are using Campaign ...
1
vote
2
answers
101
views
Javascript to-do application for native Javascript
I did a simple to-do application for native Javascript. This is my first time, previously I used only jQuery. What recommendations would be useful?
https://codepen.io/denibudeyko/pen/MWyEmox
...
1
vote
1
answer
196
views
A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support - follow up
(See the previous question.)
Now I have incorporated some suggestions by Barmak Shemirani.
See what I have:
...
0
votes
3
answers
202
views
Delayed, concurrent event stack in Java
(See the next iteration:
Delayed, concurrent event stack in Java - follow-up )
Motivation
I was confronted with a task of having "message events" for a GUI program. The use case is as ...