CMFCPropertyGridProperty and CCombobox binding

1.5k Views Asked by At

I was developing a MFC application and I noticed that the combobox which is created after the use of the method CMFCPropertyGridProperty::AddOption() does not have as many functionalities as the CCombobox class. Is there a way to bind objects from these two classes? (Better saying, is there a way to add a CCombobox object in one CMFCPropertyGrid subitem?)

If it isn't possible, is there an alternative way to use a combobox with the same (or just some) functionalities provided by the CCombobox class?

1

There are 1 best solutions below

0
On

Check CreateCombo protected member of CMFCPropertyGridProperty class. You should create the new CComboBox object within this overloaded member function and initialize it with Create. The property is responsible for the final (not so sure) clean.

UPD:

I have faced the problem with a combo box inside the property grid class some time ago. If you want to catch some extended CComboBox events or call CComboBox methods inside or outside your property class, you should define your own CreateCombo method inside your own property and call CreateCombo method of the base CMFCPropertyGridProperty class. It returns the valid CComboBox* pointer. Store this pointer inside your property member and then you can do anything with it.