A Set of 2 ActiveX Controls

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:

XFloorWndSource.zip file:

CXFloorWndCtrl - class derived from COleControl, which is the control how manage all features of XFloorWnd. _DXFloorWnd - interface with XFloorWnd control. _DXFloorWndEvents - events for XFloorWnd control.

CXFloorWndPropPage - class derived from COlePropertyPage, is the particular proertiy page fro this control. In this dialog, you can set the animation speed, and insert(delete) new items in XFloorWnd. Select Properties from Developer, after the control was registered.

CXFloorWndApp - It deals with registering, unregistering the control XFloorWnd.

CFloorObject - abstract class for store information of an object from XFloorWnd, like height, color, name....

CFloorPageObject - class derived from CFloorObject, which deals objects as pages.

CPagesListCtrl - used by CXFloorWndPropPage, to manage the items(pages) from XFloorWnd.

XFloorWndDemo.zip file:

CXFloorWnd - class derived from CWnd, which manages all events from XFloorWnd control. This class was generated by Developer Studio  I  inserted a new component to XFloorWnd file. In this file you can see all methods, and properties which you can use. After inserting, the Developer Studio generates from you a file XFloorWnd.h, and XFloorWnd.cpp, which contains all that you need to use control.

Properties of XFLoorWnd Control:

OLE_COLOR GetBackColor() - return the color of XFloorWnd' background

void SetBackColor(OLE_COLOR) - set the new color of of XFloorWnd' background

BOOL GetAnimation() - return TRUE or FALSE, if floor page will be animated.

void SetAnimation(BOOL) - set the animation to on/off

long GetSleep() - Used for animation

void SetSleep(long) - Used for animation

BOOL GetSign() - return BOOL value if right sign on page will occur or no.

void SetSign(BOOL) - set the previous value

CString GetPages() - This string contain the name and user data for all pages entered on design time into control

void SetPages(LPCTSTR) - used at design time

Methods

short AddPage(LPCTSTR sName) - add a new page called sName into control

BOOL DeletePage(short nIndex) - delete the page nIndex.

CString GetPageName(short nIndex) - return the name for page nIndex

short GetPage(LPCTSTR lpszPageName) - return the index of page with name lpszPageName

BOOL ActivatePage(short nIndex) - activates the page nIndex

BOOL AttachWindow(short nIndex, long pWnd) - You can assign to one page one window. If you will select the page then the window will show. So thing for deactivate page, hide the window.

BOOL SetPageName(short nIndex, LPCTSTR lpszPageName) - Rename page nIndex

void Init() - If you insert in design time some items, and at runtime you want to attach some windows, you must call Init function after attach operation. Is useful for resize all attached windows.

short GetHeight(short nIndex) - Get the height in pixel of page nIndex

void SetHeight(short nIndex, short nNewValue) - return the height in pixel of page nIndex

unsigned long GetColor(short nIndex) - return the color of page nIndex. Don't forget to cast the returnbed value as COLORREF

void SetColor(short nIndex, unsigned long newValue) - Set the new color for page nIndex to be newValue. newValue is a COLORREF type.

long GetUserData(short nIndex) - get the user data assigned to page nIndex

void SetUserData(short nIndex, long nNewValue) - attach to page nIndex one user data as LPARAM type.

void AboutBox() - invokes copyright dialog.

Events:

ActivatePage - this event occurs when the user selects a page

Click - this event occurs when user click everywhere in XFloorWnd control.

Download demo project

Download source


XPropertiesWnd:

What is xPropertiesWnd ActiveX Control?

Everybody knows what is a property window (exactly like in Visual Basic 5.00). This window contains many properties (name and value), group by one, or more criteria. At runtime you can add, delete, change the value, the name, enable or disable of each property. Properties window can edit items (property) throw more possibility. As sample, for a name property you can change this with an edit control. If you have more possibility to choice a combo is a good idea, and so on.

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