A Set of 2 ActiveX Controls

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Here is a set of  two ActiveX Control for enriching your User Interface.

XFloorWnd Control

XPropertiesWnd Control


XFloorWnd ActiveX Control.

What is XFloorWnd?

If somebody hs seen Microsoft Outlook, there is a control on the left side of MDI that looks like the XFloorWnd control. You will see some diferences at animation time.

Description of the classes that are used:

Description of classes used in xPropertiesWnd ActiveX Control:

 _DXPropertiesWnd – interface with methods and properties of xPropertiesWnd.

_DXPropertiesWndEvents – interface for events of xPropertiesWnd.

CAsControls – all window controls supported by xPropertiesWnd is here.

CControlsWnd – base class for all controls that can be showed on xPropertiesWnd

CControlsWnd_CComboBox – class derived from CControlsWnd . This class manages every combo.

CControlsWnd_CBoolComboBox – class to manage a boolean combo box. (With two values: False & True). This class is derived from CControlsWnd_CComboBox.

CControlsWnd_CUserComboBox – class to manage a user combo box. Not implemented yet.

CControlsWnd_CEdit – class derived from CControlsWnd, for manages an edit control into xPropertiesWnd.

CControlsWnd_CButton – class derived from CControlsWnd, for buttons.

CPageListCtrl – class derived from CListCtrl, which manages a list page from xPropertiesWnd.

CPageListCtrlDesign – class derived from CPageListCtrl, and called only in design time.

CXFloorWnd – class generated by DevStudio. This class contain all methods and properties of xFloorWnd.

CXFloorPropertiesWnd – class derived from CXFloorWnd. This works only at runtime time

CXFloorPropertiesWndDesign – class derived from CXFloorPropertiesWnd. This works only at design time.

CXPropertiesWndApp –application class.

CXPropertiesWndCtrl – xPropertiesWnd ActiveX Control. Class derived from COleControl.

CXPropertiesWndPropPage – dialog for properties page . 

Methods:

void ActivatePage(short nIndexPage) – activate page nIndexPage.

short AddPage(LPCTSTR lpszPageName) – add a new page called lpszPageName, and return the position of page

short AddProperty(LPCTSTR lpszPropertyName, LPCTSTR lpszPropertyAs, short nPropertyType) – add a new property called lpszPropertyName. lpszPropertyName can be something like this: "Page 1\Item". This means that property "Item" will be added in page named "Page1", if this will be found. lpszPropertyAs parameter can be one of the following: "Edit", "CombBox", "BoolComboBox", "Button". The property added can be enable or disable, case on nPropertyType (0 – Enable, 1 – Disable(Grayed), 2 – Disable(Black)).

BOOL DeletePage(short nIndexPage) – delete the page with index nIndexPage. Return True or False. True if page was deleted.

BOOL DeleteProperty(short nIndexPage, short nIndexProperty) – delete the property from page nIndexPage, at nIndexProperty position. Return True if successful.

BOOL _DeletePropertyByName(LPCTSTR lpszPropertyName) – delete the property called lpszPropertyName. LpszPropertyName can be in path form (Sample: "Page1 \Item")

short GetActivePage() – return the index of active page. –1 if no active page.

short GetActiveProperty(short FAR* nIndexPage) – Return the position of activate property from active page. NIndexPage will contain the value of GetActivePage. –1 if no property selected.

BOOL GetDefaultValue(short nIndexPage, short nIndexProperty, BSTR FAR* sPropertyValue) – get the value of ptoperty from page nIndexPage at nIndexProperty. The value as string will be returned in sPropertyValue. To manipulate OLE strings see SysAllocString, and AllocSysString functions from Cstring class. Return True if asked property exists.

BSTR GetDefaultValueByName(LPCTSTR lpszPropertyName) – return the value of property lpszPropertyName (Sample: "Page1\Item") as OLE string. If the return is NULL, this means that lpszPropertyName is no property, or page is not found.

short GetPage(LPCTSTR lpszPageName) – return the index of page lpszPageName. –1 if no page lpszPageName.

BSTR GetPageName(short nIndexPage) – return the name of page from nIndexPage position. NULL if no page.

long GetPagesCount() – return the count of pages from xPropertiesWnd Control.

BSTR GetPropertyAs(short nIndexPage, short nIndexProperty) – return one of the following values: "Edit", "CombBox", "BoolComboBox", "Button".

short GetPropertyCount(short nIndexPage) – return the count of properties from page nIndexPage

BOOL GetPropertyIndex(LPCTSTR lpszPropertyName, short FAR* nIndexPage, short FAR* nIndexProperty) – return true if exists property lpszPropertyName. In nIndexPage will be the page, and in nIndexProperty wil be the position of found property.

BSTR GetPropertyName(short nIndexPage, short nIndexProperty) – return the name of property from nIndexPage, at nIndexProperty position. NULL if no property.

short GetPropertyType(short nIndexPage, short nIndexProperty) – If the property from page nIndexPage at nIndexProperty position is enable, the function will return 0. Else, the returned values will be 1 or 2. 1. Both for disable property. 1 grayed property and 2 black property.

void Init() – call this function to initialize the xPropertiesWnd control.

short InsertProperty(short nIndexPage, short nIndexProperty, LPCTSTR lpszPropertyName, LPCTSTR lpszPropertyAs, short lpszProperyType) – Insert a new property with name lpszPropertyName. In this case lpszPropertyName cannot be as path form. See AddProperty method for the others parameters. One specification more. If nIndexPage == -1, means that insert will be add at the end of page.

BOOL IsProperty(short nIndexPage, short nIndexProperty) – return True is property nIndexProperty exists in nIndexPage page.

BOOL SetActiveProperty(short nIndexPage, short IndexProperty) – Set property nIndexProperty as active property. The nIndexPage page will be activate. Return true if all OK.

BOOL SetActivePropertyByName(LPCTSTR lpszPropertyName) – The same thing as SetActiveProperty(short,short).

BOOL SetDefaultValue(short nIndexPage, short nIndexProperty, LPCTSTR lpszDefaultvalue) – Set the value of property nIndexProperty from nIndexPage page to be lpszDefaultvalue

BOOL SetDefaultValueByName(LPCTSTR lpszPropertyName, LPCTSTR lpszPropertyValue) – The same thing like SetDefaultValue(short, short, LPCTSTR).

void SetPropertyName(short nIndexPage, short nIndexProperty, LPCTSTR lpszProperyName) – Rename the property nIndexProperty from nIndexPage page.

void SetPropertyType(short nIndexPage, short nIndexProperty, short nNewType) – Enable or disable the property from nIndexPage page at nIndexProperty position.

Events: 

SelectPage(short nIndex) – Occurs when a new page was activated.

UnselectItem(short nIndexPage, short nIndexItem) – After a property was unselected the control generate this event.

PropertyChanging(short nIndexPage, short nIndexProperty) – Occurs at the start of edit mode (before to edit).

PropertyChanged(short nIndexPage, short nIndexProperty) – Occurs at the end of edit mode (after edit done).

ButtonClick(short nIndexPage, short nIndexProperty) – If user click a button property, the control generates ButtonClick event

LoadItems(short nIndexPage, short nIndexProperty, BSTR* lpszItems) – Before editing a combobox, this need to be filled with items. (Sample: CString items(_T("Item1\Item2")); *lpszItems = items.AllocSysString();. The separator character is ‘\’.

Download demo project

Download source

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read