22
votes
Updating dimensions when focus is lost from any of 9 columns
I don't do C# so pardon the syntax, but you should be able to reduce the amount of code by using a for loop over a string array with your column names.
Again I don't do C# but in Java you could do ...
15
votes
Accepted
Updating dimensions when focus is lost from any of 9 columns
A shorter version would be to create an anonymous array in the if statement combined with a collection initializer where you will add all of the column names and ...
8
votes
Event functionality in C
Files
The EventListener.h file should contain only declarations, as it needs to be safe to include in object files that are linked together. Put the definitions ...
7
votes
Accepted
Handling dialog closure in a VBA user form
I like how your form is no longer concerned with anything other than being a form.
One More Abstraction Level
I'd go one step further, and encapsulate the controls, so that the presenter class doesn'...
7
votes
Accepted
Using events together with interfaces in VBA
I use an additional 'event' class, where all necessary events will be placed in, and which will be injected into the interface implementing classes.
That. That is how it's done. It's COM-friendly, it ...
7
votes
Making an Action<T> event also usable as Action<object> and Action in C#
no memory should leak when it is used correctly.
Adding and removing a handler results in an empty List<T> lingering in the ...
7
votes
Accepted
Flex panels in CSS and JS
It looks pretty good to me. I can only see a few things to consider:
More precise propertyName check You have if(e.propertyName.includes('flex')) { because Safari ...
7
votes
Accepted
Event System using C++
Avoid macros
There are many issues with macros, the general advice is to avoid them where possible.
Let's look at EVENT_TYPE_FUNCTION(): it's there to add a few ...
7
votes
CAT: Cat Approved TUIs
You appear to be asking for a review the part of the code you posted, not the library itself. (ETA: I wrote this before you posted any of the library code.) I’m not sure how useful that will be, but ...
6
votes
Accepted
Event handling attempt using some of the c++ 17 features
I'm actually not the right person to properly review your code, since event handling is outside my particular experience, so the overall idea of even having this kind of observer-handler-emitter ...
6
votes
Accepted
Simple implementation of signals and slots mechanism using templates
[code] uint64_t
It should be std::uint64_t, not uint64_t for key indexes (the latter is the C version). Or better: use ...
6
votes
Angular directive to disable a button when clicked, allowing re-enabling as needed
One of the main ways in which you can improve this is by using Renderer2 in the directive instead of directly accessing this.el.nativeElement and making changes to ...
6
votes
Accepted
Simple input class change with vanilla JS
Review
The biggest critique about the Javascript I have is that collapsedInput could be declared with const because it doesn't ...
6
votes
Process queued data in the background
Alternatives
There are plenty of robust options for message queueing in C# that handle multithreading gracefully as well as scaling to truly massive sizes.
The microsoft solution is MSMQ.
There ...
6
votes
Accepted
Wrap a js function with a fixed this arg
is there a better way to achieve this functionality?
You can use Function.bind() to create a function with the this context ...
6
votes
Animated Calendar using HTML + CSS + JS
Variables
Always use a variable declaration when first declaring your variable. If you don't your variable will be put into the global scope, which is almost never what you want. It also makes it more ...
6
votes
Accepted
Animated Calendar using HTML + CSS + JS
Welcome to Code Review. The CSS looks quite good. I haven’t seen too many style sheets with color lightsalmon 😃. Below are some suggestions.
Cache DOM references
...
6
votes
is this a good way of using events?
What you've done is conceptually wrong
Events are there to allow other objects to be notified and react when something happens.
That said, your solution works and does what you want, at least at a ...
6
votes
Follow up: A chat server using the select() API
Nice effort.
This review only addresses 2 of the 10 questions. I hope OP gets a review of the other 8 questions too.
Does any part of my code exhibit undefined behaviour?
Calls to ...
6
votes
EventBus in C++
EventBus::get_instance().push_to_queue(std::move(event));
EventBus::get_instance().process_queue();
Those seem inconvenient for the caller to write.
...
6
votes
EventBus in C++
std::forward_list
Is there a specific reason you are re-implementing a linked list inside of your event bus? Why not use ...
6
votes
Event System using C++
General Observations
This code review request does not present any C++ source files (.cpp files). It appears that you are trying to write close code without the <...
6
votes
CAT: Cat Approved TUIs
Unfortunately you've only shown some of the header files, but no concrete implementation of your TUI library, so I cannot meaningfully review that. However, we can look at your intended use of the TUI....
5
votes
Accepted
Simple event system
There is one big problem with your class: You can't have two different events with the same parameters in the functions. This is a real problem, as registering functions with no arguments is common in ...
5
votes
Mask latitude text field
Unless you know for sure that the degrees, minutes, and seconds are always going to be 2 digits each, this approach will cause issues. I would recommend using 3 separate inputs for each value and ...
5
votes
Accepted
Manipulating the browser history
An appropriate term for this code is spaghetti code – it's tightly intertwined with other parts of the app, so one cannot easily take out a part of it and reason about it without thinking about the ...
5
votes
Accepted
Simple event dispatcher
Design
Is there a need for IEventDispatcher? Defining it as an abstract base class doesn't provide much utility if there's only ever going to be one derived class.
...
5
votes
Accepted
UpvoteJS, a simple voting widget in vanilla JavaScript
Foreword
There is quite a bit of code here and it has taken a bit of time to process - especially the unit tests. I feel like the thoughts below will be incomplete but if I think of other ideas in ...
5
votes
Accepted
Tic-Tac-Toe code in JavaScript
Note, some of these require a build process
the iife should be added in the build process, it's distracting
The code doesn't expose anything. It's untestable.
var should be let or const
You can use ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
event-handling × 467javascript × 219
jquery × 80
c# × 79
c++ × 66
java × 57
html × 43
dom × 42
beginner × 34
ecmascript-6 × 34
object-oriented × 23
css × 21
form × 20
game × 18
performance × 17
c++11 × 16
swing × 16
callback × 14
wpf × 13
thread-safety × 12
gui × 12
design-patterns × 11
.net × 11
multithreading × 10
android × 10