Sunday, January 18, 2009

Moonlight TextBox

This past week I've been furiously hacking away on my reimplementation of the Silverlight TextBox control for Moonlight. I never realized just how much work goes into writing such a simple text-entry widget before this past week, even after having written Moonlight's text layout and rendering engine for the 1.0 release.

Keyboard input, keyboard navigation, keyboard selection, mouse selection & cursor positioning, key repeat, cursor blink, etc. The list goes on.

Most of it isn't hard, it's just time consuming.

At the same time, it's also fun in the sense that it's a new challenge for me to overcome (I love a good challenge). It makes you think a lot about designing for performance because you just don't know how much text you'll be rendering. It could be a short sentence or it could be an entire document, and the way you design your layout/rendering engine could mean the difference between taking 5 minutes to render or a fraction of a second.


Anonymous said...

Don't forget the stereotypical microISV approach - 500 textboxes with short sentences :)

John said...

Can Moonlight 2 not use the Silverlight 2 controls? They recently released the core and sdk controls under the Microsoft Permissive license (I'm guessing that would save the Mono/Moonlight team a lot of work).

Jeffrey Stedfast said...

John: We can and we are, but a few controls, like TextBox, are written in native code for performance reasons, and so are obviously not included in the Silverlight 2.0 Controls source code.

Anonymous said...

It would be great to see some mooonlight 2 alpha screenshots.

Code Snippet Licensing

All code posted to this blog is licensed under the MIT/X11 license unless otherwise stated in the post itself.