Files you need before using the tut :

(to save, right click and choose save picture as : 1 - icon.png, 2 - ShortcutIcon.png, 3 - PartBack.png)
This is what the gadget will look like. It will be a shortcut to the notepad application

1. Create a new folder, name it to whatever you want, the name doesn't count...
2. This is what files the folder will contain when finishing the gadget :

3. Open up notepad. We'll start creating the base of the gadget, "manifest.xml"
This is what the file should look like
the Path="part.xml" indicates the xml file that describes the visual elements of the gadget.<?xml version="1.0" encoding="utf-8" ?>
<Part Name="Shortcut Part" Group="microsoft.com" Icon="Icon.png">
<View Type="PartML" Path="Part.xml"/>
</Part>
<!-- Creating a Windows Sidebar Gadget -->
Save the file as "Manifest.xml" in the root folder
4. Open up notepad. We'll start creating "part.xml" (or whatever you set to Path= in the Manifest.xml). Part.xml describes the visual elements and objects of the gadget. The sectinos should be within the <View></View> section.
First off, we'll describe the xml using "<?xml version="1.0" encoding="utf-8" ?>" (without the quotes)
Then we'll start describing the objects by placing <View> in the next line, adding a return (new line - enter) and placing </View>.
Create a new line between the <View> and </View> statements, add an indent (tab) and define the image container "<image id="main" Stretch="both" Width="165" Height="170">" (withour the quotes). Size can be set to almos any value. Add a return and close the <image...> statement with </image>.
Add a new line between the <image...> and </image> statements and define your objects. Please note that their order in the xml is the order at which the sidebar draws them.
In this case, in the top we'll have the shortcut icon (the "shortcuticon.png" image) : "<image id="Shortcut" x="0" y="0" Source="Images\ShortcutIcon.png"/>" and then the background image : "<image id="bg" x="0" y="10" Source="Images\PartBack.png"/>", without the quotes. You should remember the image id, as it will be used when settings the action.
In the end, this is what the part.xml should look like :
save the file as Part.xml in the main folder<?xml version="1.0" encoding="utf-8" ?>
<View>
<image id="main" Stretch="both" Width="165" Height="170">
<image id="Shortcut" x="0" y="0" Source="Images\ShortcutIcon.png"/>
<image id="bg" x="0" y="10" Source="Images\PartBack.png"/>
<label x="165" y="145" Width="10" Height="10" FontSize="5" Text="Shortcut Group"/>
</image>
</View>
5. Next, we'll create part.js, the javascript file that describes the actions the gadget makes. Without it, the gadget would be a simple image...
Before anything objects and funtions should be described; in this case the object uses a shell application launcher...
Then we must define the action triggered when clicking the object like using "objectID(set in part.xml).onclick=function(){FunctionName(FunctionParameters); };" (without quotes).
For advanced javascript editing you should google for javascript tutorials...
Ok, this is how the javascript file should look like :
Save the file as Part.js in the main folder//created by speakers_jumping(hhaero)
//Speakers Jumping
// © 2005
//Model for winmatrix tutorial
var Sys = Part.CreateObject("Shell.Application");
function Launch(comm){
try
{
Sys.ShellExecute(comm);
}
catch (e)
{}
}
Shortcut.onClick=function(){Launch("notepad"); }
6.The functional parts have been created, make sure that the picture files exist (dld them from above) in the right places :

7.Compress the files into a zip archive (using any program including the xp built in zipfldr.dll)

8.Change the extension from .zip to .part

9.Move the .part file from the main folder to the parts folder located in your windows account - usually "C:\Documents and Settings\speakers_jumping\Parts" where speakers_jumping is your profile's name...

10. Click the add button on windows sidebar and the object should be there. If not, restart windows sidebar :




This topic is locked



