Thursday, 23 October 2008

What's in a name?

I have been musing over a decent name for my blog for some time now. It has been my favourite go to excuse for not following through with writing any blog topics that have come up.
The conversations in my head usually run along the lines of "i should really blog about my 3G iPhone (they rock by the way, everyone should have one) but really i need a cool name for my blog first". Lame excuse i know but the only person i had to convince was me so it was not really too hard.
Anyway i was in a meeting today at work and my manager Joe made a comment that really resonated with me (bullsh*t bingo phrase i know but the term is still relevant.) About how in our current project life cycle we've gone from XP to Agile to some form of Waterfall back to Agile and then to some hybrid form of a combination of all of these or as it was referred to.... being pragmatic. The phrase seemed to mesh nicely with how I view the world of development so i thought i would reuse it. For example whilst it would be great to use DDD, TDD, CI, pair programming, MVC/MVP on every project that comes up, the reality is that sometimes it just does not make sense to go down that path and use those particular disciplines and part of being a good developer is knowing when that is.

Anyway for me one of the key tenants of being a successful developer is recognising when someone has done something good and stealing it and claiming it as your own.
So cheers Joe I owe you a beer

Autocomplete textboxes

So we had this interesting issue on this WinForms project I have been working on. We have been making quite extensive use of autocomplete textboxes in our application and one of our testers raised a continuity issue that when they selected an auto-complete option from the list with their mouse it behaved differently from when a user hit the tab button. After some quick investigation it became apparent that there were no events to subscribe to on the auto-complete part of the control to modify the behaviour. I ran this issue past a number of my peers and we were quite stumped.

However thanks to some great work by a colleague who took it on as a personal challenge (thanks Faranak and your uber googling skills ) we managed to resolve the issue we were having. It appears that although Microsoft have effectively buried all the events and monitoring of the auto-complete part of the text box way down in the windows process there is a relatively simple fix.
When you click on one of the auto-complete text options or when you scroll down and press enter then the same thing happens. A KeyDown event is thrown with the ‘Enter’ key marked as being pressed regardless of whether it was a mouse click or the enter button pressed. Thus all we needed to do was monitor for the KeyDown event and the enter key, check that the text matches the list of codes (the auto-complete text source) for the textbox and implement our required outcome. (Cue much rejoicing)