Property list overview

zhaozj2021-02-08  205

Property table

The property table is a window that allows users to view and edit the properties of the project. For example, an spreadsheet program may use the attribute table to let the user set the border properties of the fonts and tables, and set the settings, such as a disk drive, printer, or mouse.

About property table

Use attribute table

Update to Attributes in Internet Explorer

Property table manual

About property table

This document assumes that you have already understood the dialog template and dialog box program. If this is not the case, you should read the "Dialog Boxes" in the platform SDK (PLATFORM SDK) before proceeding with the chapters below.

To implement an attribute table in your application, contain the prSht.h header file in your project. All identifiers used in PRSHT.H are included.

One or more laminated windows included in a property table are called page (Pages), each containing a set of related properties. For example, a page can contain control of type, size, color, and other attributes of the set item (Item) font. There is a label (Tab) per page, and the user can use it to select the page to use it to the most significant location in the property table. The graphic below shows a property sheet that views and sets the floppy drive properties.

Property table dialog

A property table and page are actually included in the dialog box. The property table is a system-defined dialog that is assigned pages and provides a public container for them. The property sheet dialog can be mode or non-mode. It includes a framework, a title bar and four buttons: OK, Cancel, Apply NOW and Help (Help). (Help) button may be hidden, icon above) When the user clicks the button, the dialog process is received for the page.

Each page in the property sheet is a non-mode dialog that the application definition is in the management control window to view and edit the properties of the project (Item). You provide dialog template to create each page, just like a dialog program. It manages the properties of the control and set the corresponding item (Item).

When this page is obtained or lost, the property sheet sends a notification message to the dialog as this page when you click OK, Cancel, Apply NOW or Help or Help button. process. This notification is sent in the form of a WM_NOTIFY message. The LPARAM parameter is an address of the NMHDR structure that contains the handle of the window to the property table dialog.

Some notification messages require a page to return one of TRUE or FALSE to respond to WM_NOTIFY messages. To do this, this page must be used to use the setWindowlong function to set the DWL_MsgResult value of the dwl_msgresult value of the page dialog.

Page (PAGES)

A property sheet must contain at least one page (page), but it contains the page that cannot exceed the value defined by the maxProppages (defined in the Win32 header). Each page has an index started with 0, which is assigned by the property table to add a successful order. These indexes are used, sent to the properties page.

A property page can contain a nested dialog. If this is done, you must include a WS_EX_CONTROLParent style for the top-level dialog box, and call the ISDIALOGMESAGE function with the parent dialog handler. This ensures that the user can use the memory and dialog box navigation keys to move the focus to each page with a corresponding icon (ICON) and label. The property table has established a tag card (Tab) for each page, and the icon and tag (Label) is displayed in this tab (Tab). All attribute tables are expected to use non-bold fonts. To ensure that the font is not a bold, specify the DS_3Dlook style in the dialog template.

Don't call the EndDialog function for each page dialog process. This will destroy the entire property sheet, not just this page.

The smallest attribute page is the 212 dialog unit width 114 dialog unit. If a page dialog is smaller than this, this page will be amplified to the minimum property page. The PRSHT.H header file contains three default three settings for attribute tables. PROP_SM_CXDLG and PROP_SM_CYDLG define the size of the recommended minimum attribute table page. PROP_MED_CXDLG and PROP_MED_CYDLG define the size of the recommended medium-size properties surface pages. PROP_LG_CXDLG and PROP_LG_CYDLG define the size of the recommended maximum attribute table page. PRSHT.H also contains the recommended size of the attribute watchpage. See Wizard Property Sheets for these sizes. Using these recommended sizes will help you connect your app and other Microsoft Windows applications visible.

Use the following values ​​to set the foundation size of your property table page:

Prop_sm_cxdlg Small Properties Fact Table, Dialog Unit PROP_SM_CYDLG Small Properties Table Page, Dialogue PROP_MED_CXDLG Medium Properties Table Page Wide, Dialog Unit PROP_MED_CYDLG Medium Properties Table Page The High Properties Table Page, the wide, conversation unit Prop_lg_cydlg Large Properties Height, Dialogue

Property creates

You must define one or more pages before creating a property sheet. This includes populating a PropsHeetPage structure (using the page icon, label), dialog template, dialog process, etc.), this structure is used to call the CreatePropertySheetPage function. This function returns a handle pointing to the HPropsheetPage type, which is the unique identifier.

To create a new property table, you specify the address of a PropsheetHeader structure in calling the PropertySheet function. This function defines an icon and title (Title) for the property table, and includes the address of the HPropsheetPage handle array. When the PropertySheet is newly established, it contains the identification of the page in the array. This page is displayed in the attribute table in the order included in the array.

In addition, the new way to create a property table is to specify an array of a PropSheetPage structure instead of the HPropsheetPage handle. In this case, PropertySheet creates a handle for them before adding the page to the property.

When a page is established, the dialog process receives a WM_INITDIALOG message. The LPARAM parameter of this message is the address of the new version of the PROPSHEETPAGE structure. The dialog box can be used in the structure or save this information, and then use it later to modify this page.

PropertySheet automatically sets the size and initial position of the property table. When the property table is new, this location is based on the location of the owner window, which is based on the size specified by the number of pages. If you want the page to match the width of the four buttons at the bottom of the properties, set the page width to 190 dialog units.

Add and remove the page

After you create a property table, an application can add a page using the PSM_ADDPAGE message. Note The size of the property table cannot be changed after it is established, so the new page must be smaller than the current page in the property table. An application uses the PSM_RemovePage message to remove a page. When you define a page, you can specify the address of a PropSheetPageProc callback function to allow the property table (when it is new or removed) call. Use PropSheetPageProc to give you a chance to perform an operation of initialization and eliminate individual pages.

When a attribute table is destroyed, it automatically destroyed all the pages already added. Reminding the page in the array of used to consign the page to destroy. To destroy a page created by the createPropertySheetPage function but not added to the property table, use the DestroyPropertySheetPage function.

Property Title (Title) and Tags (Labels)

You specify a title (title) of a property sheet in the PropsheetHeader structure. If the dwflags member contains a psh_proptitle value, the property table adds "Properties for" prefix to the specified title string. You can change this title by psm_settitle messages after the property table is created.

By default, a property sheet uses the name string specified in the dialog template as a page tag. You can consider the name string without considering the name string by including the PSP_USETITETETE value in the DWFlags member of the PropSheetPage structure. Psztitle members must contain the address of the page label string.

Page activation

A property table only has a activity page at the same time. This page is the active at the forefront of the laminated page. The user activates a page by selecting its tag card (Tab); an application activates a page by using the PSM_SETCURSEL message.

The property sheet sends a PSN_KILLACTIVE notification message let the page lose the focus. Respond to the message, confirm that the user changes to this page. If this page requires additional user input before losing the focus, it should use the setWindowlong function to set this page's DWL_MsgResult value (TRUE). Similarly, this page should display a message box to describe the problem and provide the recommended action. This page should set DWL_MSGRESULT as a fake when it agrees to lose the focus.

Before this page gets focus visual, the property sheet sends the PSN_setActive notification message to this page. This page should respond by initializing its control window.

Help button

When a page is activated, the property sheet determines if the PSP_HASHELP style is checked to open the (Enable) or disabled button. If this page has this style, it will support the Help button. If the PSP_Hashelp style does not exist, this button will be disabled.

When the user clicks the Help button, the activation page receives the PSN_HELP notification message. This page should respond by displaying help information, representative practices are calling the WinHelp function.

Determine (OK), Cancel and Apply Buttons

Determine (OK) and Apply Now buttons are similar; both boot the properties page to verify and apply users to the properties. It is only different to click the OK button will destroy the property table after the change is applied.

When the user clicks the OK or Apply Now button, the property sheet sends PSN_KILLACTIVE to the active page, give it a chance to verify the user's modification. If this page decides to modify it is valid, it should call the setWindowlong function to set the DWL_MSGRESULT value for this page (false). Since this, the property sheet sends a PSN_Apply notification message to each page, guides them to apply new properties to the appropriate project (Item). If this page determines that the user's modification is invalid, it should set DWL_MSGRESULT to true (TRUE) and display a dialog problem message to the user. The residers of this page are to it set DWL_MSGRESULT in response to the PSN_KILLACTIVE message. An application can use the PSM_Apply message to simulate the selected application (Apply Now) button. When a page turns into activity, the Apply Now button is invalid, marking the application without any attributes to be applied. When this page receives the input from its control, the user has edited an attribute, which should send a PSM_CHANGED message to the property table. This message causes the attribute table to deactivate the application (Apply Now) button. If the user then click Apply NOW or Cancel button, this page should reiniterate its control and send the PSM_unchanged message to relish the application (Apply Now) button.

Sometimes the Apply NOW button causes a page to become a property sheet and is not reversible. This page should send a psm_canceltoClose message to the PSM_CANCELTOCLOSE message. This message causes the attribute table change to determine the text on the button to "Close", which mark the change in the application is not canceled.

Sometimes a page changes the configuration of the system, requiring Windows to restart or need to restart before changing the effectiveness. When such a change occurs, a page should send a PSM_RestartWindows message or a PSM_Rebootsystem message deceity table. These messages cause the properties table after destroying, the propertySheet function returns the ID_psrestartWindows or ID_PSREBOOTSYSTEM value.

When the user clicks on the cancel button, the table sends a PSN_RESET notification message to all pages, which marks that the attribute table is about to be destroyed. A page should use notifications to perform cancellation operations.

Guide property table

You can create a special type of property table called Wizard (Wizard), which consists of a set of order dialogs, which guides the user's order step by step, this is very like set a setting or create a birthday . In the wizard property table, the page does not have a label card (Tab) and only one page is visible at the same time. Similarly, a wizard property is used for the previous step, the next step (next) or the FINISH button replaces the OK and Apply Now button, the Cancel button continues to exist. To tell which button is available, use the PSM_SetWizButtons message with PSWIZB_BACK, PSWIZB_NEXT, PSWIZB_FINISH, and PSWIZB_DISABLEDFINISH.

Just create a wizard attribute table like a standard property table, of course, you must include a psh_wizard value in the DWFlags member of the PropSheetHeader structure. The system ignores the PSZCAPTION member; replaces the label (Label) of the current page in the title bar of the property sheet. When the user is next to a page next page, the system update the label update title using the current page.

Use the following values ​​to set the foundation size of your wizard property. Use these values ​​to make sure your page meets Windows standards.

Wiz_BodyCX is wide in the width of the page. The body does not include a range of bitmaps. WIZ_BODYX horizontal coordinates of the upper left corner of the main body in the wizard property table. Rising coordinates for page main body Use 0Wiz_CXBMP to be wide in the range of bitmaps in the widget. Use wiz_cydlg to set the high bitmap range. WIZ_CXDLG is wide in the width page of the guide. WIZ_CYDLG is in the middle of the wizard property table. The dialog process receives all the same notification messages in the pages in the wizard, like a standard property table page. In addition, one person wizard attribute table page receives three standard attribute table non-receiving notification messages: PSN_WIZBACK, PSN_WIZNEXT and PSN_WIZFINISH. When the user clicks on the previous step, the next step (Next) or the Finish button, receives these notifications.

When the user clicks on the previous step or the next step (Next) button, the property sheet proceeds to the previous page or next page. An application can prevent the attribute table in advance by setting the DWL_MSGRESULT value to -1 in the psn_wizback or psn_wiznext notification. To immediately skip to a previous page or next page, an application should set the identifier of DWL_MsgResult to the displayed dialog.

When the user clicks the finish button, the system automatically dishes the wizard property table. An application can prevent the wizard from being destroyed by setting DWL_MSGRESULT in the PSN_WizFiniSult message.

Property page extension

A property page extension is a dynamic link library that adds one or more pages to the property table, which is created by other modules. This module creates a hometribution page contains an AddPropsheetPageProc callback function, which is extended DLL call to add a page. The function receives the 32-bit value that points to a handle of a page and the application defined.

Extended DLL also includes a callback function called ExtensionPropsheetPageProc to receive an address of the address from this module to create an attribute table. Extending the DLL must output extensionpropsheetpageproc.

The Windows header file contains two prototypes defined by the property table callback function. To define AddPropsheetPageProc, use the following prototype:

TypeDef Bool (HPROPSHEETPAGE, LPARAM)

To define ExtensionPropsheetPageProc, use the following prototype:

TypeDef Bool (Callback Far * lpfnaddpropsheetpages) (LPVOID, LPFNADDPROPSHETPAGE, LPARAM)

Use attribute table

This section contains how to create an example of a property sheet and processing notification message.

Create a new property table

In this case, a property table has been built, which contains two pages, one is the font attribute of the unit in the spreadsheet program, and the other is the frame properties of the setting unit. The example is defined by filling a pair of PropsheetPage structures, specifying its address in the PropSheetHeader function and calls the PropertySheet function. Dialog templates, icons and pages Labels (Label) are loaded from resources from the application's executable. The icon of the property table is also loaded from the application's resources.

// DOPROPERTYSHEET - Create a property table with two pages

// hwndowner - Points the handle of the owner window of the property table.

//

// Global variable

// g_hinst - instance handle

EXTERN HINSTANCE G_HINST;

Void DopropertySheet (HWND HWNDOWNER)

{

PropSheetPage PSP [2];

Propsheetheader psh;

PSP [0] .dwsize = sizeOf (PropSheetPage); PSP [0] .dwflags = psp_useiconid | psp_usetitle;

PSP [0]. Hinstance = g_hinst;

PSP [0] .psztemplate = makeintResource (DLG_FONT);

PSP [0] .pszicon = makeintResource (IDi_font);

PSP [0] .pfndlgproc = fontdialogproc;

PSP [0] .psztitle = makeintResource (IDS_FONT)

PSP [0] .lparam = 0;

PSP [0] .pfncallback = NULL;

PSP [1] .dwsize = sizeof (PropSheetPage);

PSP [1] .dwflags = psp_useiconid | PSP_USETITLE

PSP [1]. Hinstance = g_hinst;

PSP [1] .psztemplate = makeintResource (DLG_Border);

PSP [1] .pszicon = makeintResource (IDi_border);

PSP [1] .pfndlgProc = borderdialogproc;

PSP [1] .psztitle = makeintResource (IDS_BORDER);

PSP [1] .lparam = 0;

PSP [1] .pfncallback = NULL;

psh.dwsize = sizeof (PropSheetHeader);

Psh.dwflags = psh_useiconid | psh_propsheetpage;

psh.hwndparent = hwndowner;

psh.hinstance = g_hinst;

psh.pszicon = makeintResource (IDi_cell_properties);

Psh.pszcaption = (lpstr) "Cell Properties";

Psh.Npages = SizeOf (PSP) / sizeof (PropSheetPage);

Psh.nStartPage = 0;

Psh.ppsp = (lpcpropsheetpage) & PSP;

psh.pfncallback = null;

PropertySheet;

Return;

}

Processing notification message

A property sheet sends a WM_NOTIFY message to get information from the page and report the page of the user's action. The LPARAM parameter of this message is the address of the NMHDR structure. This address contains the handle of the Property Table dialog, the handle pointing to the page dialog and a notification code. This page must respond to some passages through the DWL_MsgResult value of the set page.

The following example is the code snippet in the Pages dialog process. It shows how to deal with PSN_HELP notification messages

Case WM_NOTIFY:

Switch ((NMHDR FAR *) LPARAM) -> Code) {

Case psn_help:

{

Char szbuf [file_len]; // Buffer for Name of Help File

// Display Help for the Font Properties Page.

LoadString (G_HINST, IDS_HELPFILE, & SZBUF, FILE_LEN)

WinHelp ((NmHDR Far *) LParam) -> HWndFrom, & Szbuf,

Help_context, IDH_FONT_PROPERTIES; BREAK;

}

.

// That handles other property sheet notifications

.

}

Update to Attributes in Internet Explorer

The property list supports the following new features in Microsoft® Internet Explorer.

New notice

PSN_GETOBJECT notifications allow a page to perform OLE drag and drop objects.

Updated structure

PropSheetHeader and

The PropSheetPage structure has been updated to support new features. See these structures.

转载请注明原文地址:https://www.9cbs.com/read-3450.html

New Post(0)