Research on sidebar

Source: Internet
Author: User

Research on sidebar
【Abstract]

Sidebar in Vista is also a new thing in windows. I took some time to study it and made a summary here.
The research is not very deep. If there are any incorrect points, please make a brick.

[Full text]

1. Implementation of gadget
Gadget is an HTML page displayed on the sidebar or on the desktop by the sidebar program. You can use scripts and CSS (stacked style sheets) to control the page behavior and display, in addition, sidebar provides a set of objects to support some special features of gadget, such as file access and storage settings.
1. Description of the main components of the gadget File
It is essential to have two files:
> Gadget. xml: The xml configuration file of gadget, whose file name must be gadget. xml;
> Gadget.html: The homepage file. The file name can be any one. The file name is set in the gadget. xml file;
  
Other files:
> Flyout.htm: flyout page files, which can contain multiple files. You must specify the file name in the script. The file name is arbitrary;
> Settings.htm: Set the page, which is also specified in the script. The file name is arbitrary.
  
For more information, see the description in vistasidebartutorial.pdf. The storage location of these files must be in the sidebar installation path or the corresponding path in the user's application data path (see 2.1 installation path), and the root directory extension must be. Gadget.
2. Main attributes and events of gadget
The main properties displayed on the interface are:
> System. Gadget. settingsui: Specify to set the page file. If the page is too large, it may not be displayed normally. The width should be less than 400.
> System. Gadget. flyout. File: Specifies the flyout page file, which is assigned a value when flyout is opened, and then opens the flyout page by setting system. Gadget. flyout. Show = true.

The main events displayed on the interface are:
> System. Gadget. onshowsettings: Before the setting page is opened;
> System. Gadget. onsettingsclosed: the setting page is closed;
> System. Gadget. onundock: this operation occurs when you drag a gadget instance out of the sidebar;
> System. Gadget. ondock: It occurs when you drag the gadget back to the sidebar;
> System. Gadget. onsettingsclosed: This occurs when the page is closed;
> System. Gadget. flyout. onhide: the flyout page is closed;
> System. Gadget. flyout. onshow: occurs when the flyout page is opened;

The above events must be specified in the onload event of the body on the home page.
> System. Gadget. onsettingsclosing: This occurs before the settings page is closed. You can check whether the input data is correct and save the settings. This event is specified in the onload event on the settings page.

For more detailed events and attributes, refer to msdn:
Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/sidebar/reference/objects/systemcontact/city. asp
2. Insert ActiveX Controls
Some security tips may be displayed when the ActiveX control is directly opened on the HTML page, but there is no prompt in the gadget.
<Object ID = "myactivexcontrol" classid = "CLSID: XXXXXXXX-XXXX-xxxxxxxxxxxx"> </Object> is embedded in the page.
You can directly call the open methods or access open properties of this control in the script.
3. Install gadget
The installation package of gadgetis actually a zip package or Cabage. The extension name is gadget. after you compress the written file into a package, you can directly change the extension name. Zip or. Cab to. Gadget. Double-click the compressed package with the. Gadget extension and you will be prompted whether to install the package. Sidebar will decompress the package to the % USERPROFILE %/appdata/local/Microsoft/Windows Sidebar/gadgets directory.
4. Install and uninstall the SDK through a program
You can modify the configuration file of the gadget by installing and uninstalling the program.
  
4.1 installation location:
> User: % USERPROFILE %/appdata/local/Microsoft/Windows Sidebar/gadgets
> All users: sidebar installation path/gadgets

4.2 configuration file:
There is a setting in the installation path of % USERPROFILE %/appdata/local/Microsoft/Windows Sidebar and sidebar. INI file, which records the display information and saved configuration information of the current gadget sidebar. The content of the main file is as follows:

// Root
[Root]
Settingsversion = "00.00.00.01"
Sidebarshowstate = "imploded"
Sidebardockedpartsorder = "0x3, 0x4, 0x2," // display order of the gadget
Section0 = "1"
Sidebarautostart = "true"
Sidebardockside = "2"
Sidebaralwaysontop = "false"
Sidebardockmonitor = "0"
Sidebardockedpartspage1 = "1"
Onetimeremovegadgetmessageshown = "true"
Pickerposx = "192"
Pickerposy = "160"
Onetimeexitmessageshown = "true"
Onetimecloselastdockedmessageshown = "true"
Onetimehidemessageshown = "true"

// The name list of the currently displayed gadget, which is represented by a number,
// This number corresponds to the display order above.
Section1 = "2"
Section2 = "3"
Section3 = "4"

// The status and settings of each gadget. Each [] is the start of a gadget,
// The number corresponds to the name list above
[Section 2]
Privatesetting_gadgetname = "D: % 5 cusers % 5 cddl % 5 cappdata % 5 clocal % 5 cmicrosoft % 5 cwindows % 20 sidebar % 5 cgadgets % 5cplatformassist. Gadget"/gadget installation directory name
Privatesetting_enabled = "true" // whether a setting page exists
// The following rows are the fields set on the settings page.
Username = ""
Password = ""
Url = ""
Updatetime = ""
// Set the end of the field

Privatesetting_gadgettopmost = "false" // whether it is at the top
Privatesetting_sidebardockedstate = "not % 20 docked" // call status
Privatesetting_gadgetdroplocationx = "314" // location X on the desktop
Privatesetting_gadgetdroplocationy = "46" // location y on the desktop

[Section 3]
Privatesetting_gadgetname = "D: % 5 cprogram % 20 Files % 5 cwindows % 20 sidebar % 5 cgadgets % 5cclock. Gadget"
Privatesetting_enabled = "true"
Privatesetting_sidebardockedstate = "docked"
Privatesetting_gadgettopmost = "false"
[Section 4]
Privatesetting_gadgetname = "D: % 5 cprogram % 20 Files % 5 cwindows % 20 sidebar % 5 cgadgets % 5ccpu. Gadget"
Privatesetting_enabled = "true"
Privatesetting_sidebardockedstate = "docked"
Privatesetting_gadgettopmost = "false"

Note: All the texts above start with // are post-added annotations, which do not exist in the configuration file.

Note: This file is protected during sidebar operation.
5. Other Instructions:
The script running error on the page will not be prompted, and the script will stop running after the error occurs, and alert (Message) will no longer work;
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.