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
2
votes
1answer
85 views

Create a GUI to update parameters of an Object

I have an Glob object which represents a glob of data. It has several parameters like size, the date it was created, who created it, and so on. I'm building a GUI ...
2
votes
2answers
72 views

Enabling or disabling buttons on certain events

I need to run the following checks in two occasions: When a certain modal is first shown or clicked, When one of two inputs is filled. How can I remove redundancy in the following code? ...
8
votes
0answers
453 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 (...
4
votes
2answers
99 views

Individual collapsible areas with accessibility in mind

I've been learning Javascript by creating reusable individually collapsible areas (not using jQuery) and I was wondering if someone could review it and let me know if there is anything they would do ...
5
votes
0answers
66 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, ...
1
vote
1answer
522 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 ...
10
votes
2answers
465 views

In memory data access for CSV files that may have changed

I'm reading data from CSV files and store the result in a simple DataContext instance that gets injected throughout my application. ...
0
votes
0answers
44 views

JavaScript class for the browser Viewport

After years of wishing there was a class that encapsulated the idea of a browser view port, I went ahead and built one. Features include: Basic dimensions of the viewport Scroll position Adding and ...
4
votes
1answer
137 views

Simon in Javascript

This is a game of Simon using plain Javascript. I would welcome any comments, suggestions, insights or ideas for improvement. One choice that I made was to have the player's turn compare values ...
3
votes
1answer
1k 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): ...
15
votes
2answers
2k 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 ...
3
votes
1answer
76 views

Notifying players about certain events

This class looks ugly as hell to me. I feel like there is a better way but can't really think for a good one. Too many instanceofs and else ifs. What OOP practices or design patterns would you suggest ...
1
vote
1answer
44 views

Emitting event on close of other event (event chaining)

I have a software that does the following in sequence: download text files from s3 reads the files collect the data from files The program is asynchronous-...
1
vote
2answers
325 views

Updating the total when any of a set of spinners changes its value

I'm new person who working on jQuery and I need your help. ...
3
votes
1answer
47 views

Controling Document and Window events via array

I have recently taken on a task to rewrite some very old javascript / jquery and many of the issues are dozens of JS files with onready, onload, onscroll events everywhere and in no logical order! It ...
4
votes
1answer
784 views

Handling dialog closure in a VBA user form

I already asked a Code Review question about Working with a new form instance every time. As far as I have decided, that the most important part of the code is to work with the instance of the form ...
2
votes
0answers
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 ...
3
votes
0answers
61 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: ...
2
votes
1answer
284 views

Truncate text to some number of words when clicked

I am currently using the code below to truncate text: ...
2
votes
2answers
681 views

Custom log4net raising application-level events

Use Case: I have a form application in which I log events to a file/database and have a need to also raise those events to the application itself (for display purposes). Think old school updating ...
7
votes
2answers
3k views

Updating dimensions when focus is lost from any of 9 columns

How can I write this more pretty? ...
1
vote
1answer
887 views

Winforms tools for selection of items using ComboBox - binding datasource

This is mi UserControl containing ComboBox and few buttons for selecting and manipulating collection of items which implement simple interface IHasHeader (just ...
1
vote
1answer
184 views

Changing a pixel based on a keypress

I have this code that is working as intended I would just like to speed it up. ...
4
votes
1answer
2k views

Simple Event Dispatcher for Game

I am currently programming a game in java, and I recently implemented a centralized event dispatcher system in order to decrease coupling between different parts of my game. My system consists of ...
6
votes
1answer
2k views

Simple event system

I made this simple event system: ...
2
votes
1answer
387 views

Event emitter in JavaScript without using Node's built in class or any additional libraries

I need to create this eventEmitter class with the functions listed below. I think I could clean the code a little but don't really know where to start. ...
2
votes
2answers
246 views

Automatic redrawing in WPF

I would like to re-render my WPF chart control when data source is changed. My minimum requirement for a data source is IEnumerable<Point> but it could be ...
2
votes
0answers
53 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 ...
3
votes
0answers
148 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 ...
1
vote
1answer
46 views

Handling workflow rules for a job application process

For some reason I always have a negative feeling towards having many if statements in my JavaScript functions. But I've got some code that is processing an object ...
1
vote
2answers
470 views

Many event listeners

Is there an alternative possibly cleaner way (without so much repetition) to write the following? I'm thinking about the headache it's going to be when I have to remove all of my even listers. ...
2
votes
0answers
199 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: <...
2
votes
1answer
91 views

Passing object back to Windows Form button event

I have windows form application. One button event starts the script via object called ScriptStarter. The status of object is used to pass message and color to UI (toolStripStatusLabel1). I'm not sure ...
3
votes
2answers
775 views

Callback system for events in a window

I have written a simple window event capture wrapper that gets events that happen to the window, and can be checked anywhere in the program through a global class. I wanted to be able to create a ...
4
votes
1answer
2k views

Custom event handling system

I'm relatively new to C++ (learned it years ago, but never used it much until now), and I needed an exercise to get a better handle on the language. I also needed a good way of handling events, and ...
4
votes
1answer
129 views

Basic C# R-E-P-L

So I was thinking of making a C# REPL, as I didn't find any viable solution that would work for me, so I made a simple, basic one, I am sure it can be improved, as it seems once the REPL class is ...
2
votes
1answer
111 views

Removing same event from listener

I have a myDiv.mousedown, window.mousemove, and window.mouseup event. I'm trying to organize ...
5
votes
1answer
13k views

Communicating upwards from nested fragments in Android

I recently asked this question on Stack Overflow, but now that I have a working example, I would like to have it checked. I set up the layout like this: I am going off the idea that parents can talk ...
3
votes
1answer
4k views

TabPage version of SelectedIndexChanged

I order to speed up opening of a file (which contents are displayed in a series of tabs), I made it so that tab content is generated only when the user first clicks on the tab. If user never opens the ...
3
votes
1answer
221 views

Using a MutationObserver to reformat numbers in the user's locale

I mostly just want to make sure I've understood the specs correctly with this code, but here goes: ...
5
votes
1answer
2k views

Simple event manager in Java

I have created a simple event manager and I want it to work properly in a multithreaded environment: ...
1
vote
2answers
3k views

Use jQuery to force two checkboxes mirror each other's state

RESTRICTION: jQuery 1.6.4 only, no other library, or version can be used. My goal is to use jQuery to allow two input checkboxes behave the same. For example: If 1st checkbox is checked, 2nd will be ...
2
votes
1answer
371 views

Client Side JavaScript [aka Greasemonkey] Key Event Handler

Description The code captures keypress events that do not occur in a text field and dispatches on the properties of a $command object in the application execution ...
4
votes
1answer
100 views

Swing Game EyeHandCoordination

Question copied from the book: (Game: eye-hand coordination) Write a program that displays a circle of radius 10 pixels filled with a random color at a random location on a panel, as shown in ...
3
votes
1answer
204 views

Make one greenlet tell another to shutdown

I am building a commandline app to check proxies, which has a daemon flag (running forever or just once). There are producers, checkers and storers. I want them to run in parallel and be able to ...
0
votes
1answer
130 views

Highlight Two Closest Points Java Swing

Question from the book: (Geometry: closest pair of points) Write a program that lets the user click on the panel to dynamically create points. Initially, the panel is empty. When a panel has two or ...
1
vote
2answers
199 views

CRUD code for a finance WebForm

I have a finance web-application in ASP.NET WebForms using Telerik RAD controls. Two event handlers wound up being very similar in implementation. What steps could I take to improve the organization ...
0
votes
1answer
80 views

Wait for a “3rd party” element to be appended to the DOM

Let's say we're writing a user script which interacts with a 3rd party site we don't control. We want to open a menu, so we trigger a click on the button and then wait 10ms before accessing the menu (...
2
votes
0answers
405 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 ...
3
votes
1answer
55 views

Event-triggering - Ready, On, Fire

I have implemented a kind of thing that does event triggering in Golang. This is open-sourced here. Review and suggestions appreciated. First thing I am trying to implement is adding event listeners ...

1 2 3
4
5
9