Running a Panel in Desktop Sidebar

During the development of your panel, you will want to run it inside Desktop Sidebar to see your results so far and to test if it is functioning correctly.

First find the Desktop Sidebar plugins directory, which is located by default in:
c:\Documents and Settings\\Application Data\Desktop Sidebar\plugins
Now, inside the plugins folder, create a folder for your panel. Its name should be identical to the .dsplugin file's name. In your panel's folder you should place your .dsplugin file and any accompanying files like the icon file (.bmp), skin file (.dsskin), etc.

That's all there's to it - Desktop Sidebar will now recognize your panel. To add your panel to Desktop Sidebar, right click anywhere and click Add Panel. In the Add Panel dialog box, find your panel and select it, and click Add. Now you can interact with your panel and test it.

Tip: if you modify your .dsplugin file and want to test the changes, there is no need to restart Desktop Sidebar. Simply remove your panel and add it again.

Testing and Debugging

Usually during development you find yourself trying to find problems and trace their causes. For this, Desktop Sidebar provides a few functions.

Message Boxes

First, the message box. Sometimes it's just useful to see if the panel reached a certain code function or to see during runtime the value of a variable. An easy way to accomplish this is to display a debug message box, using the sidebar.MsgBox(text, title, flags) function. The following is an example of calling this function.

sidebar.MsgBox("In function doBlahBlah(). Value of variable var1:" + var1, "Debug Message", 0);

Of course, once you are ready to release your panel, remove these message boxes so the user won't see them.

The Desktop Sidebar Log File

Desktop Sidebar keeps a log file for debugging purposes. This logfile can then be checked and analyzed to find problems. You can easily write your own messages to this logfile, using the sidebar.Log(message) function. For example:

sidebar.Log("MyPanel: error executing function ...");

The log file is located in the Temp folder (%temp%\dsidebar.log). You can also view the contents of the log file by right clicking Desktop Sidebar, clicking Options, and in the About tab, clicking Show Log.

Breaking into the Debugger

A debugger can run a script line by line, and lets you check the values of variables during runtime. To break the panel's script and launch the debugger, use the DebugBreak function, just like that:

DebugBreak();

This will ask you if you want to debug, and will let you choose from a list of debugging applications installed on your computer. The .NET Framework SDK installs a debugger that can debug script.

Learning how to use the debugger is beyond the scope of this document.