Dynamically Updated JavaScript Image Randomizer

My solution for a dynamically updating image randomizer in JavaScript

My latest focus is mastering web development, specifically ASP.Net MVC with Bootstrap and jQuery. There’s a huge amount of information to learn but none of it is particularly difficult. About the most foreign part for me has been dealing with JavaScript scope and context.

Example. I have a single page application (SPA) that is going to host an image. Every time the page updates I want to display a different image from a list at random. It’s easy to find examples on how to do this. However, the examples only work on a full page load or only for one location. Since this is a SPA there’s rarely a page load (I’m extensively using AJAX against my Web API) and I plan on more than one image list.

Here’s my solution. This was initially based on the “Chicken Dinner” plugin from http://chickendinner.sosweetcreative.com/
Continue reading

WinForm Label Not Getting Focus

I have a user control that contains a few other controls, including Labels.  When any of the controls gets focus I want the parent to get notified.  I added an Enter event handler to the parent.  (Note: with Forms the equivalent to Enter/Leave is Activate/Deactivate.)  This almost works – any time I click on anything *except* the Labels the parent control gets focus.  After a bit of research I realized my error – Labels cannot receive focus, therefore the Enter event never fires despite it being there due to deriving from the Control class. (Enter and Leave events travel up the tree so all parents controls get notified.)

Stepping back, what I really want is that when I click anywhere on the control an Enter event is fired.

Continue reading