Attribute Table
An Attribute Table is a window that allows users to view and edit project properties. For example, a workbook program may use Attribute tables to allow users to set the font and table border attributes, and set the attributes, such as a disk drive, printer, or mouse.
Attribute Table
Use Attribute Table
Update an Attribute Table in Internet Explorer
Attribute Table Manual
Attribute Table
This document assumes that you have fully understood the dialog box template and dialog box program. If this is not the case, read the "dialog box" (dialog boxes) in the Platform SDK (Platform SDK) before proceeding to the following chapter ).
To implement an Attribute Table in your application, include the prsht. h header file in your project. Prsht. h contains all the identifiers used by the Attribute Table.
One or more stacked windows in an Attribute Table are called pages, each containing a set of settings windows for relevant properties. For example, a page can contain controls on the type, style, size, color, and other attributes of the item font. Each page has a tab. You can use it to select a page and use it to move it to the most prominent position in the Attribute Table. The following illustration shows an Attribute Table for viewing and setting disk drive attributes.
Attribute Table dialog box
An Attribute Table and page are actually included in the dialog box. An Attribute Table is a system-defined dialog box that manages pages and provides them with a public container. The Attribute Table dialog box can be in the mode or non-mode. It includes a framework, a title bar, and four buttons: OK, cancel, apply now, and help ). (The Help button may be hidden, as shown in the preceding figure.) When a user clicks the button, the dialog box receives notification messages on the page.
Each page of the Attribute Table is an application-defined non-mode dialog, which is used in the management control window to view and edit the properties of a project. You provide a dialog box template to create each page, just like a dialog box program. It manages and controls the attributes of corresponding items.
When this page gets or loses focus, and when you click OK, cancel, apply now, or help, the Attribute Table shows the process of sending a notification message to the dialog box on this page. This notification is sent in the form of a wm_notify message.LparamThe parameter is the address of the nmhdr structure and contains the handle to the window pointing to the Attribute Table dialog box.
Some notification messages require a page to return either true or false to respond to the wm_notify message. To do this, this page must be used
The setwindowlong function sets dwl_msgresult to either true or false for the page dialog box.
Pages)
An Attribute Table must contain at least one page, but the page cannot exceed the value defined by maxproppages (defined in the Win32 header file ). Each page has an index starting with 0, which is allocated to the Attribute Table in the order of addition. These indexes are used by messages and sent to the property page.
A property page can contain a nested dialog box. If this is done, you must include the ws_ex_controlparent style in the top-level dialog box and call
Isdialogmessage function. This ensures that you can use the memory and dialog box navigation keys in the nested dialog box to move the focus to the control.
Each page has an icon and a label ). The Attribute Table creates a tab for each page to display the icon and label in the tab ). All Attribute Table pages are expected to use non-bold fonts. To ensure that the font is not bold, specify the ds_3dlook style in the dialog box template.
Do not call the dialog box process for each page
Enddialog function. This will destroy the entire Attribute Table, not just this page.
The minimum attribute page is 212. The dialog unit width is 114. The dialog unit height is. If a page dialog box is smaller than this, the page will be enlarged to the minimum attribute page size. The prsht. h header file contains three default settings on the property Table Page. 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 attribute surface page. Prop_lg_cxdlg and prop_lg_cydlg define the size of the recommended maximum Attribute Table Page. Prsht. H also contains the recommended size for the property table Wizard Page. For details about these dimensions, see wizard property sheets. Using these Recommended dimensions will help you visually connect your applications to other Microsoft Windows applications.
Use the following values to set the basic size of your Attribute Table Page:
Prop_sm_cxdlg |
Width of the small Attribute Table Page, dialog Unit |
Prop_sm_cydlg |
The page height of a small Attribute Table. The dialog unit is |
Prop_med_cxdlg |
Width of the medium-sized property Table Page, dialog Unit |
Prop_med_cydlg |
The page height of a medium-sized property table. The dialog unit is |
Prop_lg_cxdlg |
The width of a large Attribute Table Page. The dialog unit. |
Prop_lg_cydlg |
Large Attribute Table Page height, dialog Unit |
Attribute Table Creation
Before creating an Attribute Table, you must define one or more pages ). This includes filling in a propsheetpage structure (using the page icon, label, dialog template, Dialog Box Process, and other information to fill in). This structure is used to call the createpropertysheetpage function. This function returns a handle pointing to the hpropsheetpage type, which is the unique identifier of this page.
To create an Attribute Table, you must specify the address of the propsheetheader structure in the propertysheet function. This function defines the icon and title for the Attribute Table, and also contains the address of the hpropsheetpage handle array. WhenPropertysheetWhen creating an Attribute Table, it contains page recognition in the array. This page is displayed in the order that the Attribute Table contains in the array.
Another way to create an Attribute Table is to specify an array of the propsheetpage structure to replace the array of the hpropsheetpage handle. In this case, the propertysheet creates a handle for them before adding the page to the Attribute Table.
When a page is created, the dialog box receives a wm_initdialog message for the page. This messageLparamThe parameter is the address of the propsheetpage structure of the newly created page. The dialog box can be used later to modify the page by structure or saving the information.
Propertysheet automatically sets the size and initial position of the Attribute Table. When an Attribute Table is created, the position is based on the location of the owner window and the size is based on the size specified by the page array. To match the width of the four buttons at the bottom of the property table, set the page width to 190.
Add and remove pages
After creating an Attribute Table, an application can use the psm_addpage message to add a page. Note that the size of an attribute table cannot be changed after it is created. Therefore, the new page must be smaller than the current page in the Attribute Table.
An application uses the psm_removepage message to move a page. When you define a page, you can specify the address of a propsheetpageproc callback function to call the Attribute Table (when it is creating or moving this page. UsePropsheetpageprocThis gives you a chance to initialize and delete individual pages.
When an Attribute Table is destroyed, it automatically destroys all added pages. Remove the pages from the array specified during page creation in reverse order. To destroy a page created through the createpropertysheetpage function but not added to the Attribute Table, use the destroypropertysheetpage function.
Attribute Table title and Tab)
You can specify the title of an attribute table in the propsheetheader structure to create an Attribute Table. IfDwflagsThe member contains the psh_proptitle value. The Attribute Table adds the prefix of "properties for" to the specified title string. You can use the psm_settitle message to change the title after the Attribute Table is created.
By default, an Attribute Table uses the name string specified in the dialog box template as the tab of the page. You can useDwflagsThe member contains the psp_usetitle value, regardless of the name string.PsztitleThe member must contain the address of the page tag string.
Page Activation
An Attribute Table has only one active page at a time. This page is the top edge of the activity on the stacked page. You can activate a page by selecting its tab. An application activates a page by using the psm_setcursel message.
The property table sends a psn_killactive notification message, removing the page focus. Respond to the message and confirm your changes to this page. If this page requires additional user input before it loses focus, it should use
The setwindowlong function sets the value of dwl_msgresult on this page to true ). Similarly, this page should display a message box to describe the problem and provide recommended actions. When it agrees to lose focus, this page should set dwl_msgresult to false)
Before the focus is visible on this page, the property table sends the psn_setactive notification message to this page. This page should be responded by initializing its control window.
Help button
When a page is activated, the Attribute Table checks the psp_hashelp style to determine whether to enable or disable the Help button for this page. If this page has this style, it supports the Help button. If the psp_hashelp style does not exist, this button is forbidden.
When you click the Help button, the activation page receives the psn_help notification message. This page should be responded by displaying help information. A representative way is to call the winhelp function.
OK, cancel (cancel), and apply now
The OK button is similar to the Apply Now button, which directs the property page to verify and modify the attributes of the application. The difference is that clicking the OK button will destroy the Attribute Table after the change is applied.
When you click OK or apply now, the property table sends the psn_killactive message to the activity page, giving it a chance to verify the user's modification. If this page decides that the modification is valid, it should call
The setwindowlong function sets the dwl_msgresult value to false for this page ). In this case, the property table sends the psn_apply notification message to each page, guiding them to apply the new property to the corresponding item ). If this page determines that the user's modification is invalid, it should set dwl_msgresult to true and display a dialog box with question information to the user. This page is left till it is in the responsePsn_killactiveSet dwl_msgresult to false in the message. An application can use the psm_apply message to simulate the application (apply now) button.
When a page becomes active, the Apply Now button is invalid at the beginning, indicating that no attribute changes are required for the application. When this page receives the input from its control, it indicates that the user has edited an attribute. This page should send the psm_changed message to the Attribute Table. This message causes the Attribute Table to activate the Apply Now button. If the user then clicks the apply now or cancel button, this page should re-initialize its control and send the psm_unchanged message to re-prohibit the application (apply now) button.
Sometimes the Apply Now button changes a page into an Attribute Table and is irreversible. When this happens, this page should send the psm_canceltoclose message to the Attribute Table. The text on the OK button is "close", which indicates that the application changes cannot be canceled.
Sometimes a page changes the system configuration and requires windows to be restarted or restarted before the change takes effect. After such a change, a page should send the psm_restartwindows message or psm_rebootsystem message to the Attribute Table. After these messages cause the Attribute Table to be destroyed, the propertysheet function returns the id_psrestartwindows or id_psrebootsystem value.
When you click the cancel button, the table sends the psn_reset notification message to all pages, which indicates that the attribute table will be destroyed immediately. A page should be deleted using notifications.
Wizard Attribute Table
You can create a new (Wizard), Which is composed of a set of ordered dialog boxes. It guides you to perform operations step by step in order, this is like setting a setting or creating a new birthday. In the wizard Attribute Table, there is no tab and only one page is visible at a time. Similarly, a wizard Attribute Table uses the back button, the next or finish button replaces the OK and apply now buttons, and the cancel button is canceled) button continues to exist. To tell the Attribute Table which button is available, use the psm_setwizbuttons message with pswizb_back, pswizb_next, pswizb_finish, and pswizb_disabledfinish values.
Create and initialize a wizard attribute table just like a standard Attribute Table.DwflagsThe member contains the psh_wizard value. System ignorePszcaptionMember. In addition, the label of the current page is placed in the title bar of the Attribute Table ). When a user goes from one page to the next page, the system update uses the label of the current page to update the title.
Use the following values to set the basic size of your wizard Attribute Table. Use these values to ensure that your page meets windows standards.
Wiz_bodycx |
The width of the page subject in the Wizard Attribute Table. The subject does not contain the bitmap range. |
Wiz_bodyx |
Horizontal coordinates in the upper left corner of the subject in the Wizard Attribute Table. Use 0 for the rising coordinate of the page subject |
Wiz_cxbmp |
The width of the bitmap range in the Wizard Attribute Table. Use wiz_cydlg to set the height of the bitmap range. |
Wiz_cxdlg |
The page width in the Wizard Attribute Table. |
Wiz_cydlg |
The height in the Wizard Attribute Table. |
In the dialog box, all the same notification messages are received for the pages in the properties table of the wizard, just like the standard Attribute Table Page. In addition, the one-person wizard Attribute Table page receives three standard attribute tables that do not receive notification messages: psn_wizback, psn_wiznext, and psn_wizfinish. When you click back, next, or finish, the Wizard Page receives these notifications.
When you click the back or next button, the attribute table goes forward to the previous page or next page. An application can set the dwl_msgresult value to-1 in the psn_wizback or psn_wiznext notification to prevent Attribute Table advances. To jump to the previous page or next page immediately, an application should set dwl_msgresult to the identifier of the displayed dialog box.
When you click Finish, the wizard Attribute Table is automatically destroyed. An application can prevent the wizard from being destroyed by setting dwl_msgresult to a non-zero value in the psn_wizfinish notification message.
Property page Extension
An Attribute page extension is a dynamic link library that adds one or more pages to the Attribute Table and is created by other modules. The attribute page created by this module contains an addpropsheetpageproc callback function, which is called by the extended DLL to add a page. The function receives the handle pointing to a page and the 32-bit value defined by the application.
Extension DLL also contains a callback function called extensionpropsheetpageproc, which receives the address of addpropsheetpageproc from this module to create an Attribute Table. Extension DLL must be outputExtensionpropsheetpageproc.
The Windows header file contains two prototypes defined for the property table callback function. To define addpropsheetpageproc, use the following prototype:
typedef BOOL (CALLBACK FAR * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM);
To define extensionpropsheetpageproc, use the following prototype:
typedef BOOL (CALLBACK FAR * LPFNADDPROPSHEETPAGES)(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM);
Use Attribute Table
This section contains examples of how to create an Attribute Table and process notification messages.
Create an Attribute Table
In this example, a new attribute table is created, which contains two pages: one is to set the font attribute of the Unit in the workbook program, and the other is to set the border attribute of the unit. In this example, the page (pages) is defined by filling in a pair of propsheetpage structures, its address is specified in the propsheetheader function, and the propertysheet function is called. The dialog box template, icon, and page label are loaded from the resources in the executable file of the application. Attribute Table icons are also installed from application resources.
// Dopropertysheet-create an Attribute Table containing two pages // hwndowner-handle pointing to the owner window of the Attribute 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 (& PSH); return ;}
Process notification messages
An Attribute Table sends a wm_notify message to obtain information from the page and report the page of user action. This messageLparamThe parameter is the address of the nmhdr structure. This address contains the handle pointing to the property table dialog box, the handle pointing to the page dialog box, and a notification code. This page must respond to some notification messages by setting the dwl_msgresult value to true or false.
The following example shows the code snippet in the page dialog box. It shows how to process the psn_help notification message
Case wm_policy: 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 ;}.. // process other Attribute Table notifications here .}
Update an Attribute Table in Internet Explorer
The properties table supports the following new features in Microsoft Internet Explorer.
-
New notification
-
The psn_getobject notification allows an OLE drag-and-drop object on a page.
-
Updated Structure
-
The structure of propsheetheader and propsheetpage has been updated to support new features. See references for these structures.