?
Solved

ActiveX - VB Property Categories

Posted on 1998-10-12
9
Medium Priority
?
280 Views
Last Modified: 2013-11-20
I create an ActiveX control with MFC

I add a property say "Caption".  No problem...I don't need help with the code.

However I do need help with this:
My ActiveX control lists it's Caption property under "Misc" when it's inserted in a VB Form (property window in VB for the controls).  However I want it to appear under "Appearance" category in VB like the standard static control.

Question is -
1. how do I fix this
2. how does VB decide what categories to sort the control's properties into (e.g. What goes into Misc, what goes into Appearance, etc.)

Thanks
0
Comment
Question by:Answers2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
9 Comments
 
LVL 8

Author Comment

by:Answers2000
ID: 1323223
BTW : i'm fairly clued up on Windows / MFC.  I even know a bit of OCX/ActiveX stuff, so I don't need tonnes of background info, unless it's immediately relevant to the question at hand.


0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323224
BTW : i'm fairly clued up on Windows / MFC.  I even know a bit of OCX/ActiveX stuff, so I don't need tonnes of background info, unless it's immediately relevant to the question at hand.


0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323225
Increased pts
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Author Comment

by:Answers2000
ID: 1323226
Has anybody got any help - or even read this ?
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 1323227
yes i read this. i have no answer but i'm confused.
till now i was thinking that the right way is to build the ActiveX in VB and use them in C++, and not the other way around.
0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323228
AnswerTheMan - The host app, and the control can both be in more or less any language (including C/C++, VB, Delphi and probably a few more too).  Mix and match to your preferences..

I'm doing high performance graphics - hence the C++ for the control
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 300 total points
ID: 1323229
Nice Question
I found this at http://www.vcdj.com/vcdj/aug98/atl1.asp

3. How do I support property categories?

The OCX96 specification defines the ICategorizeProperties interface to categorize different properties in the container's property browser. Microsoft Visual Basic supports this categorization for its Property Inspector and obtains this interface through QueryInterface(). So, to support this feature, the control writer must implement the ICategorizeProperties interface.

ICategorizePriorities supports two methods, declared as follows:



MapPropertyToCategory( [in] DISPID, [out] PROPCAT*)
GetCategoryName( [in] PROPCAT, [in] LCID, [out] BSTR*)


The first returns the category ID for the property whose dispid is passed in. The second method returns the text name of the category requested. This latter method need not be supported unless the control has specific categories of its own. It also should not be called for any standard category IDs of which the container already should be aware. The following standard category IDs are documented in the specification:

#define PROPCAT_Nil-1#define PROPCAT_Misc-2#define PROPCAT_Font-3#define PROPCAT_Position-4#define PROPCAT_Appearance-5#define PROPCAT_Behavior-6#define PROPCAT_Data-7#define PROPCAT_List-8#define PROPCAT_Text-9#define PROPCAT_Scale-10#define PROPCAT_DDE-11

The following steps show how to implement the ICategorizeProperties interface in your ATL control:

1. Declare the ICategorizeProperties:



const IID IID_ICategorizeProperties =
    {0x4D07FC10,0xF931,0x11CE,{0xB0,0x01,0x00,0xAA,0x00,0x68,0x84,0xE5}};

typedef int PROPCAT;

interface ICategorizeProperties : public IUnknown
{

STDMETHOD(MapPropertyToCategory)(/*[in]*/ DISPID dispid,
                  /*[out]*/ PROPCAT* ppropcat) = 0 ;

STDMETHOD(GetCategoryName)(/*[in]*/ PROPCAT propcat,
                  /*[in]*/ LCID lcid,
                  /*[out]*/ BSTR* pbstrName) = 0 ;

};


2. Include the interface in the control class's base class list:



class ATL_NO_VTABLE CXXX :
                  public CComObjectRootEx<CComSingleThreadModel>,
                  public CComCoClass<CXXX, &CLSID_XXX>,
                  public CComControl<CXXX>,
                  …
                  …
                  public ICategorizeProperties

{


3. To enable the QueryInterface() for ICategorizeProperties add the corresponding COM_INTERFACE_ENTRY macro:



BEGIN_COM_MAP (CXXX)
      ...
      ...
      COM_INTERFACE_ENTRY(ICategorizeProperties)
END_COM_MAP ()


4. Implement the methods of ICategorizeProperties:



STDMETHOD(MapPropertyToCategory)(   /*[in]*/ DISPID dispid,
                  /*[out]*/ PROPCAT* ppropcat
                  )
{
      if(dispid >=1000 && dispid <=1005)
      {
         *ppropcat = 1;      
         return S_OK;       
      }
      return E_FAIL;
}

STDMETHOD(GetCategoryName)(      /*[in]*/ PROPCAT propcat,
                  /*[in]*/ LCID lcid,
                  /*[out]*/ BSTR* pbstrName
                  )
{
      if(propcat == 1)
      {
            *pbstrName = ::SysAllocString(L"Instrument");
            return S_OK;
      }
      return E_FAIL;
}
0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323230
I'll try this and let you know
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1323231
I works pretty cool.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question