And here are the basic steps for creating simple Gadget:
userDirAppDataLocalMicrosoftWindows SidebarGadgetsgadgetName.gadget
Below is the details we need to do.
Step 1: Create a new folder on the desktop and name it HelloGadget.gadget
Step 2: Open the newly created folder and continue to create 2 new files. This is the source code of the gadget.xml file:
HelloGadget
1.0.0.0
Hello World Gadget.
Full
However, there is one point that can confuse many people, which is the name of the HTML file in the code:
And below is the code for that HelloGadget.html file:
Hello World!
Step 3: Open Windows Explorer and select the following folder:
userDirAppDataLocalMicrosoftWindows SidebarGadgets
Here, userDir is the account name in use. Otherwise, copy directly through the following link:
% localappdata% MicrosoftWindows SidebarGadgets
In this folder, we will see all the gadgets installed, each of which has a file with an extension of .gadget (if you want to learn more about the nature of gadgets, open it. and see the source code with NotePad).
Step 4: Drag and drop the HelloGadget.gadget folder directly from the desktop to the above folder.
To check, right-click on the desktop and select Gadgets, at this point we will see the HelloGadget in the displayed list:
Gadget has a default icon, but the name is already set in the XML file
So basically, we have completed some basic steps to create gadgets. But this is just the beginning, there are many things that can be done if we find out more.
Multi-purpose JavaScript debugging tool, most commonly used is the alert () function, which is not available when running as a widget. So to debug, drag and drop the HTML file into the web browser and run it, where the alert () function will work normally.
In Windows 7, there is a Registry key that directly affects this debug process:
[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionSidebar]
"ShowScriptErrors" = dword: 00000001
The above settings will trigger notifications when an error occurs.
If you use Visual Studio, you can use the Just-In-Time feature by inserting the code:
debugger;
at the beginning of each segment