Back from vacation. ActionsPane, Part 0.

I took some time off from work for a family vacation. We spent our relaxation week on Vancouver Island in Canada. Here is more info since already couple of people have asked. The place we stayed at is called Beach Acres in Parksville, BC. We rented an ocean view unit with kitchenette and 2 bedrooms. It was just half a minute away from getting to the sand of the beautiful Rathtrevor Beach. The beach is located in the bay which keeps the waters incredibly calm (just like in the pool but with presence of some marine life and without getting allergies from the chlorine). It is very shallow so despite being generally part of the Pacific the water warms up in this place. It also makes for a nice walk during the low-tide. One can wade hundreds of meters into the ocean and dig up the abundant shellfish, catch crabs, build sand castles that are destroyed with the next tide. The kids had fantastic time as well. The only thing that still puzzles me is some irregularity of the tides - one day it would be 2 tides, another day it is 3. It all would happen during different times of the day without any easily understandable cycle. One low-tide could go up to 400 meters away others would be just 200. No recognizable pattern for me whatsoever although reading the local newspapers could help - they do run the tides guide.

So, it was then and now I am back in my office. Oh, not exactly. Eric made some arrangements for part of our team to go on an offsite and spend some time in building 36 with Office. Nothing super secretive but I can not tell you about it to not spoil anything that might come out of this.

In other news - in mid-September I am getting out of my Redmond office and going to PDC. Meeting the customers and seeing their side is always fun and gives us inspiration as well. I am looking forward for this especially since Office has so much content to present they even got a separate track in the conference.

Now back to the ActionsPane. The conception of ActionsPane was a perfect example of a customer driven inspiration. Chris Kunicki was the early adopter of then new SmartDocs technology in Office 2003. SmartDocs umbrella has more than just a programmable task pane but the programmable task pane is the pivotal feature. You could finally plug your own rich UI into Office. Chris was understandably excited and he even contracted to put together samples of SmartDocs that went out as part of Office 2003 Beta programs. He did this only to realize there is something missing to make SmartDocs a success.
Putting together a programmable task pane using SmartDocs technology is not for weak hearted. To name a few difficulties:

  • The central piece is an ISmartDocument interface with 25 methods in it most of which need to be implemented to show a single button control.
  • The controls in the SmartDocs are stateless. Once the cursor moves from one XML element to another the controls were destroyed and re-created again. So it was up to the developer to maintain the controls state.
  • You could have only 1 button click event handler which was called if any of the buttons were clicked. So if you had 5 buttons you needed to assign every one of those an ID. When button was clicked this ID was passed to the event handler (which is just another method on the interface) and you would go from there. Messy...

I can go on and on with the list ... And there was no designer whatsoever! So during the early planning days of VSTO Chris sent an e-mail and ask for the designer experience. Then he asked again. And we would reply that it is very hard to put up a designer to support ISmartDocument interface - it took several years to develop WinForms designer we just did not have the resources. But he would ask again.
And then the light bulb went off. We realized we did not need to create the ISmartDocument designer. All we needed is just to find a way to host WinForms inside the task pane. This WinForm would fill the entire pane area and would serve as a container for the components designed by the developers.
Then things started to happen with the speed of light. The first prototype was just positioning a WinForm form on top of the task pane. It had some message routing problems but it did gave people the ability to see the potential behind the concept. The right hosting solution is to host the WinForms natively e.g. the way IE does it - through ActiveX interfaces. Next, Office added the capability to stretch the ActiveX control to fill the task pane area entirely. This was especially incredibly because it happened only 2 months before Office 2003 shipped. Next Brian fixed for us the issues in WinForms that cause some focus management issues - you can see those issues if you use .NET Fx 1.1 to show UserControl in the task pane.

And it was ready. Chris likes to say ActionsPane is his favorite feature and I could not agree more.

In my next posts I will talk about creation of vanilla ActionsPane, then using UserControls to design ActionPane components, adding context sensitivity to the ActionsPane using new XMLNode's ContextEnter and ContextLeave events, discuss some usability aspects of the ActionsPane, answer questions (if any) and possibly provide some peek under the hood.