locked
problem with ISpecifyPropertyPages -- the property page title is wrong RRS feed

  • Question

  • Hi experts,

    The ISpecifyPropertyPage interface indicates that an object supports property pages. OLE property pages enable an object to display its properties in a tabbed dialog box known as a property sheet. An end user can then view and change the object's properties. A property page object manages a particular page within a property sheet. A property page implements at least IPropertyPage and can optionally implement IPropertyPage2 if selection of a specific property is supported.

    An object specifies its support for property pages by implementing ISpecifyPropertyPages. Through this interface the caller can obtain a list of CLSIDs identifying the specific property pages that the object supports. If the object specifies a property page CLSID, the object must be able to receive property changes from the property page.

     


    Thanks, B.C.
    • Edited by Bo,Chen Monday, May 10, 2010 8:02 AM
    Thursday, May 6, 2010 4:40 AM

Answers

  • i've resolved this problem.

    it's because in the ppdispBrowseObj object, we also need to provide a Name property. This property is used to populate the properties page dialog title.

    simply speaking, the process is like: IVsObjectList::GetBroswerObject->ICfgProvider->ICfg + ISpecifyPropertyPage->GetPages()->IPropertyPage(s)

     

     

    I'm sad that there is no documentation even mentioning it. I learn it from a code sample.

    as some person said before, visual studio, and other Microsoft products as well, are woefully thought out products with little documentation written in PhD level


    Thanks, B.C.

     

    • Marked as answer by Bo,Chen Tuesday, May 11, 2010 7:18 AM
    Tuesday, May 11, 2010 7:11 AM

All replies

  • I'm going to put my question in another way since there is no response so far..

    1.What's the relationship between IPropertyPage and IVsProjectCfg? I can see they are used in populating the property page, but i don't know how they work underneath

    2.What class is the prototype class of Property Page (the one you get thru right clicking an project node in solution explorer and then selecting "properties")?


    Thanks, B.C.

    • Edited by Bo,Chen Monday, May 10, 2010 8:03 AM
    Friday, May 7, 2010 7:03 AM
  • As to IPropertyPage, within a project configuration page, we can have a lot of property pages which are all instances of IPropertyPage,  each IPropertyPage will contains a PropertyGrid, which will display the property descriptors you have defined

    and as to IVsProjectCfg, it stored information for your project -- dedub/release, platform. For each IVsProjectCfg, you will have an instance of IPropertyPage

    That's mostly all what i know about this 2 interfaces

    Problem is, I cannot find the interface that the whole Property Page window implements .

    I do know that, the "properties" menu item is handled by visual studio IDE, but i dont' know how visual studio populates  this page. And problem is: the project configuration page has wrong title.

    I think my question is clear enough now....


    Thanks, B.C.
    • Edited by Bo,Chen Monday, May 10, 2010 8:04 AM
    Friday, May 7, 2010 9:15 AM
  • After some research, i'm now able to answer most of the questions I've asked before

     

    =============================================================================

     

     

    A project configuration page contains two parts:

    1. Project Configuration (IVsCfg  i.e. debug/release and plat form)
    2. Property Pages which are collections of property descriptors

    If either of these 2 parts is missed, visual studio will use the default property window to response to “properties” menu item.

    By assocaiting an IVsSpecifyPropertyPage interface to a normal libararyNode (i.e. class Node in class view), and implementing the IVsSpecifyPropetyPage::GetPages() method, we tell visual studio IDE that our element node has defined its own property page and won't use the default properties window -- that's how you overridden the default "properties" behavior.

    In IVsSpecifyPropetyPage::GetPages method, you pass visual studio a page guid list (which are all IVsPropertyPage instances) to let visual studio know what to display within this property page. This actually resolved the 2<sup>nd</sup> part(Propery Pages).

    However, since for different configurations (IVsCfg), the configuration properties are mostly different, we also need the configuration info. I.e. the 1<sup>st</sup> part.

    So, how to provide IVsCfg to the configuration page??

    Within

    int IVsObjectList::GetBrowseObject(

                uint index,

                out Object ppdispBrowseObj

    )

    you provide a ppdispBrowseObj object which is typically used to populate the property window.

    However, in our case, since we want to provide configuration page to a class node, we also need to implement IVsGetCfgProvider interface to this object (the ppdispBrowseObj you have created), and implement the

    int IVsGetCfgProvider ::GetCfgProvider(

                out IVsCfgProvider ppCfgProvider

    )

    method – if we don’t, visual studio will refuse to display the configuration page and use default properties window instead.

    int IVsCfgProvider::GetCfgs(

                uint celt,

                IVsCfg[] rgpcfg,

                uint[] pcActual,

                uint[] prgfFlags

    )

    will return all the configurations (a combination of debug/release and platform) that the current project has.

     

    Still have no idea on where the property configuration page title comes from..

     


    Thanks, B.C.
    Monday, May 10, 2010 7:51 AM
  • i've resolved this problem.

    it's because in the ppdispBrowseObj object, we also need to provide a Name property. This property is used to populate the properties page dialog title.

    simply speaking, the process is like: IVsObjectList::GetBroswerObject->ICfgProvider->ICfg + ISpecifyPropertyPage->GetPages()->IPropertyPage(s)

     

     

    I'm sad that there is no documentation even mentioning it. I learn it from a code sample.

    as some person said before, visual studio, and other Microsoft products as well, are woefully thought out products with little documentation written in PhD level


    Thanks, B.C.

     

    • Marked as answer by Bo,Chen Tuesday, May 11, 2010 7:18 AM
    Tuesday, May 11, 2010 7:11 AM