Custom properties not holding 
Author Message
 Custom properties not holding

Salutation,

How do you make your custom properties persistent so that they keep their values
when i close the current workspace?

I have a composite control and i have added one custom property (iNbrCol)

////////////////////////////////////////////////////////////////
// CmyList
class ATL_NO_VTABLE CmyList :
        public CComObjectRootEx<CComSingleThreadModel>,
        ...
{
...
public:
    int iNbrCol;

Quote:
}

STDMETHODIMP CmyList::get_NbrCol(long *pVal)
{
        AFX_MANAGE_STATE(AfxGetStaticModuleState())
        *pVal = iNbrCol;
        return S_OK;

Quote:
}

STDMETHODIMP CmyList::put_NbrCol(long newVal)
{
        AFX_MANAGE_STATE(AfxGetStaticModuleState())
        iNbrCol = newVal;
        SetDirty(true);
        SendOnDataChange(0);
        return S_OK;

Quote:
}

Now the value i set for this property will hold as long as i am in design time.
Once i close the project and open it again the default value of 0 keeps coming
back.

Obviously i need to serialize my new property (somehow).

How can i do that?
Any sample for a composite control in MSDN? (couldn't find one)

Thank you in advance,

Francois Belair



Mon, 26 May 2003 03:00:00 GMT  
 Custom properties not holding
Just add an entry for it using PROP_ENTRY to a proeprty map (between
BEGIN_PROP_MAP and END_PROP_MAP). If you created a control with Wizard,
property map is created for you and comments show how to add your entries to
it.
--
With best wishes,
    Igor Tandetnik


Salutation,

How do you make your custom properties persistent so that they keep their
values
when i close the current workspace?

I have a composite control and i have added one custom property (iNbrCol)

////////////////////////////////////////////////////////////////
// CmyList
class ATL_NO_VTABLE CmyList :
public CComObjectRootEx<CComSingleThreadModel>,
        ...
{
...
public:
    int iNbrCol;

Quote:
}

STDMETHODIMP CmyList::get_NbrCol(long *pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
*pVal = iNbrCol;
return S_OK;

Quote:
}

STDMETHODIMP CmyList::put_NbrCol(long newVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
iNbrCol = newVal;
SetDirty(true);
SendOnDataChange(0);
return S_OK;

Quote:
}

Now the value i set for this property will hold as long as i am in design
time.
Once i close the project and open it again the default value of 0 keeps
coming
back.

Obviously i need to serialize my new property (somehow).

How can i do that?
Any sample for a composite control in MSDN? (couldn't find one)

Thank you in advance,

Francois Belair



Mon, 26 May 2003 03:00:00 GMT  
 Custom properties not holding

Salutation Igor Tandetnik,

Thanks it's working now :-)


Quote:
> Just add an entry for it using PROP_ENTRY to a proeprty map (between
> BEGIN_PROP_MAP and END_PROP_MAP). If you created a control with Wizard,
> property map is created for you and comments show how to add your entries
to
> it.
> --
> With best wishes,
>     Igor Tandetnik



Mon, 26 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. BUG: Custom Build Step not shown in Properties

2. VB's mousepointer property not working when set from event of custom ATL control

3. VB5 does not like my control's custom property pages

4. Privilege not held on InvokeMethod

5. libc internal error: _rmutex_unlock: rmutex not held.

6. HELP!: libc internal error: -rmutex_unlock: rmutex not held.

7. HOWTO: Getting Custom Property Descriptions

8. Fill Custom Usercontrol property with object list

9. Can't use complex properties in custom control

10. Support DataMember property from a custom data source component

11. default value for custom component properties

12. Property options with Extender/Custom Designers

 

 
Powered by phpBB® Forum Software