Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Tue Jun 23, 2009 9:28 am Post subject: HOWTO: Show property pages for inner items of a namespace extension. |
|
|
Just like you can use EZShellExtensions.Net to develop a property sheet extension for the root node of your namespace extension, you can use EZShellExtensions.Net to show property sheet for inner items. To do so, create a property sheet extension derived from the PropertySheetExtension class from EZShellExtensions.Net. Add this class to the same project as your namespace extension.
1. In the GetMenuItems method override of your NSEFolder derived class, include the 'properties' verb as follows :
[C#]
Code: | e.Menu.AddItem("Properties", StandardVerbs.Properties, "Displays the properties of the selected items"); |
[VB.Net]
Code: | e.Menu.AddItem("Properties", StandardVerbs.Properties, "Displays the properties of the selected items") |
2. In the GetAttributes method override of your NSEFolder derived class, include 'NSEItemAttributes.HasPropSheet' in the list of attributes.
3. Override the OnProperties virtual method of your NSEFolder derived class and use the following code:
[C#]
Code: | public override bool OnProperties(ExecuteMenuitemsEventArgs e)
{
NSEPropertySheet propSheet = new NSEPropertySheet();
propSheet.Caption = "Properties"; // caption
propSheet.HWndParent = e.HWnd; // parent window
MyPropertySheetExtension ext = new MyPropertySheetExtension();
// The e.Children contains the namespace items for which the properties are being shown -
// We will pass it on to the property sheet extension
// 'items' is a member we have defined of type NSEItem[]
ext.items = e.Children;
// Add the extension to the list of pages
propSheet.Pages = new object[] { ext };
// Show
propSheet.Show();
return true;
}
|
[VB.Net]
Code: | Public Overrides Function OnProperties(ByVal e As ExecuteMenuitemsEventArgs) As Boolean
Dim propSheet As NSEPropertySheet = New NSEPropertySheet()
propSheet.Caption = "Properties" 'caption
propSheet.HWndParent = e.HWnd ' parent window
Dim ext As MyPropertySheetExtension = New MyPropertySheetExtension()
' The e.Children contains the namespace items for which the properties are being shown -
' We will pass it on to the property sheet extension
' 'items' is a member we have defined of type NSEItem[]
ext.items = e.Children
' Add the extension to the list of pages
propSheet.Pages = New Object() {ext}
' Show
propSheet.Show()
Return True
End Function |
Notes
Since you will also be using EZShellExtensions.Net in the project, add the reference to EZShellExtensions.Net dll typically installed at
'C:\Program Files\LogicNP Software\EZShellExtensions.Net 2009\LogicNP.EZShellExtensions.dll" |
|