Saturday, April 21, 2007

I was never much of a JavaScript guy. There were probably lots of reasons why I never found the need or want to code in it. I’ll just mention a few here, chime in if they resonate with you too ;-).

1.       Tooling around JavaScript has always been comical at best

2.       Difficult to debug. (kinda like #1.)

3.       Difficult to maintain.

4.       Drank too much Koolaid  as a child (nuff said ay?).

5.       Who understands this stuff any way; everyone copies online samples or does “View Source” on your favorite site?

However, my biggest impedance with it may have been the fact that I always wanted the full power of the OS (machine) behind my code, so that I could do all those cool Computer Sciency things, like OO, compilation, type safety, etc.

In either case a while back (Dec or Jan I think)I decided to play around with this great (Script #) tool.  I did have to learn a bit of HTML and CSS, but I was able to build a set of controls rather quickly. I believe I had it all in done in about 2 weeks (including getting up to speed with the HMTL and CSS and DOM). Not bad for a newbie if I say so my self. I do however credit S# and Nikhil's API for that , the ability to build browser client code quickly, especially since I was able to apply the techniques I have used for years.

Now a few months past that initial proof of concept I decided to share the controls with the community. Ok, brace for the BIG Disclaimer. The first control was the Tab and probably the worst in usability, some of the others are cleaner. I will eventually refactor the whole thing, but for now they are built around a pseudo Winforms  style.

I put together a couple of pages demoing some of the controls, namely ComboBox,TreeView, GridView and TabControl.

 

I may add some more usage samples soon or if I ever blog again. I may also share more of my original proof of concept, in the mean time enjoy the controls. You can always just rip the JavaScript and use that directly (I am a realist) :-P, the code could be used as plain ol' vanilla Java Script Controls.

Eddy

 

Windark.Script.zip (420.66 KB)

Updated the link to Nikhil.

PS. Added a link here or there.

4/21/2007 6:05:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments [5]  | 
Monday, November 06, 2006

I think by now most developers that use MS tools are aware of the proverbial "Mort" persona Microsoft created around the VB user. In fact, there are some interesting links on the Internet regarding this issue.

I'll just list 2 of my favorites here, but of course feel free to Google to your hearts content.

However, it never dawned on me to think of it this way until I saw this today.

Mort is Dead!

PS. After seeing that, which one is the real Mort? Bah, I should have used the clever line "Would the real Mort please stand up...:

11/6/2006 2:56:22 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]  | 
Friday, November 03, 2006
Watermarks seem to be all the rage these days for data entry input fields on websites.  In fact, even Vista seems to be jumping on the band wagon with the Search Box.

MSDN Search Box

Recently, the team and I did some UI work for the major project we've been working on. There are lots of neat Visio mockups we put together -- prototypes, etc.. I would add that the UI in general looks fairly slick, if I may say so myself. However out of all the things we did, we were missing this new cool watermark feature.

One of course could fairly trivially achieve this in Windows Forms by overriding the Paint event, among perhaps several other implementations. The problem of course lies in that this must be done for all controls one would like to display a watermark.

You may be asking yourself "how many could there be?". Well, lets see, of the top of my head I think of the following:

  • TextBox

  • MaskedTextBox

  • ComboBox

  • ListBox (Perhaps?)

Ok, five controls is not that bad right? Well let's consider that if you're using Menu and Toolbars, then we need to add at least 2 more, perhaps more if you do ToolStripControlHosting (see How to: Wrap a Windows Forms Control with ToolStripControlHost ).

  • ToolStripTextBox

  • ToolStripComboBox

Ah, so 7 controls, that implement basically the exact same logic. What about DataGridViews? Those have the TextBox cell. I think by now you get the point.

Of course, I have left out the dependencies you're creating for such a simple feature, in case you already have existing controls and or replacing existing ones.

Solution

My solution, instead of using inheritance and overriding, I thought this was a good case to use the IExtenderProvider . This interface does not directly refer to the pseudo pattern Microsoft has been using as an extensibility point in much of the .NET 2.0 stack.

Instead, the purpose of the IExtenderProvider is to let developers augment existing Components/Controls with additionally properties without using inheritance. This feature essentially adds properties to the design time on your control via the PropertyGrid. One of the most common used extender providers is the ToolTip component.

This then begs the question since this interface adds properties, that still does not solve how to draw when there is no text in the control and use the default behavior otherwise.

For this I decided to use an existing control to perform the rendering by superimposing it over the existing controls, namely the label control. To get the desired look, I simply set the background property to transparent and the forecolor to GrayText. That's all!

Part of using this alternative solution to was to prevent the covered control from knowing any implementation details about the watermark, this is just good object oriented design. The label should subscribe to certain events like when the covered control gets focus, then the label should be hidden. Also, when the covered control is resize this should be taken into account so that perhaps the watermark can be centered.

Additional Notes

I decided to use a separate label for each control that receives a watermark, however the WaterMarkColor property on the WaterMarkProvider sets the color for all. Keep in mind you can have multiple WaterMarkProviders on a given form.

BTW, currently there seems to be a bug with the combo box support. I'll look at this later unless someone takes the initative ;-)

Enjoy!

Download

11/3/2006 10:40:05 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]  | 
Monday, October 23, 2006

Pretty cool video. Although I think many people have seen some of these sample apps. It's still provides a good summary.

http://go.microsoft.com/?linkid=5452295

10/23/2006 11:42:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
Tuesday, August 29, 2006

I am unsure if this is old and has been around already, but I recently received it via email. In either case I thought it was amusing.

How to handle office conflicts.

8/29/2006 9:00:29 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]  | 

Really funny cartoon for anyone following the whole Kiko sale.

http://jkanstyle.com/2006/08/29/e-true-hollywood-story-kiko/

8/29/2006 8:50:06 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  | 
Wednesday, August 16, 2006

Ok I know that was a crazy title but you'll get it if you read this great post.

http://wesnerm.blogs.com/net_undocumented/2006/08/powers_of_ten.html

I especially like the factor of 10 history and the original video is well simple remarkable.

http://www.youtube.com/watch?v=qrUQboKx_KE

For giggles the Simpson one is neat.

http://www.youtube.com/watch?v=yCfDRvDWid0

8/16/2006 7:59:14 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
Monday, August 14, 2006

So I am sure all the Microsoft watchers are all over this one. Well, what the heck! Windows Live Writer seems like a neat program so far and it beats using any of those html controls, no matter how much javascript they use.

Here is the home page: http://windowslivewriter.spaces.live.com/

Download: Download Writer!

PS. This was my first post using it.

8/14/2006 12:31:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  | 
Friday, August 11, 2006

So everyone thinks concurrency will be super important in the years to come. And who would disagree? I recently found this link on the MS Research page. Of course everyone's heard about C Omega, since it was the prototype for the implementation of generics, but did you know about the concurrency lib?

Joins - A Concurrency Library

Comega promised C# programmers a more pleasant world of concurrent programming. Comega had a simple, declarative, and powerful model of concurrency—Join Patterns—applicable both to multithreaded applications and to the orchestration of asynchronous, event-based distributed applications. By exploiting Generics in the Common Language Runtime, we can provide join patterns as a library rather than as a language feature. Offering a library has advantages: The library is language neutral, supporting C#, Visual Basic, and other languages; and the library's join patterns are dynamic, supporting solutions difficult to express with the static join patterns of Comega. The Joins library is efficient and has a simple interface that makes it easy to translate Comega programs to C#. The installer includes a tutorial, documentation, samples, and demos.

8/11/2006 8:58:50 AM (Eastern Standard Time, UTC-05:00)  #    Comments [5]  | 
Thursday, August 10, 2006

Wow! Even if you're not into music, you have to appreciate this video.

http://www.youtube.com/watch?v=QjA5faZF1A8&feature=Favorites&page=1&t=t&f=b

 

 

8/10/2006 9:37:56 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 

http://www.windwardreports.com/film.htm

Luckily at BNY (Bank of New York), we use rubber bands and hacky sacks instead of beach balls. And the most offending pranks are t'ping each other's white boards.

Enjoy!

8/10/2006 8:10:29 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  | 

Theme design by Jelle Druyts