Property return to default value at run-time in VB 
Author Message
 Property return to default value at run-time in VB

Hi,

I have a control which has only 1 property. I can change the property at
design-time in a simplest VB project. But, the property return to the
default value at run-time.

What's the problem?



Mon, 07 Feb 2005 01:29:53 GMT  
 Property return to default value at run-time in VB
You are not persisting the property. List it in a property map - see
BEGIN_PROP_MAP, PROP_ENTRY, END_PROP_MAP.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Hi,

> I have a control which has only 1 property. I can change the property
at
> design-time in a simplest VB project. But, the property return to the
> default value at run-time.

> What's the problem?



Mon, 07 Feb 2005 01:46:53 GMT  
 Property return to default value at run-time in VB
thanks Igor, i got it.


Mon, 07 Feb 2005 02:45:14 GMT  
 Property return to default value at run-time in VB
I am having trouble getting this same problem to work.  Here is my property
map:

 BEGIN_PROP_MAP(CQualcommCtrl)
  PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  PROP_ENTRY("AppName", 1, CLSID_NULL)
  PROP_ENTRY("UserName", 2, CLSID_NULL)
  // Example entries
  // PROP_ENTRY("Property Description", dispid, clsid)
  // PROP_PAGE(CLSID_StockColorPage)
 END_PROP_MAP()

I added the PROP_ENTRY for UserName and AppName.  The DISPID's correspond to
the [id(n)] in the .idl file.  Both properties are of type BSTR if that
makes any difference.  Now I rebuild my ActiveX control and in eVB type
anything in for either of the properties and it still goes back to a blank
string after I press enter.  Am I leaving something out?  Project is an ATL
COM AppWizard for eVC++3.0 I inserted the control using the ATL Wizard and a
"Full control".


Quote:
> You are not persisting the property. List it in a property map - see
> BEGIN_PROP_MAP, PROP_ENTRY, END_PROP_MAP.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > Hi,

> > I have a control which has only 1 property. I can change the property
> at
> > design-time in a simplest VB project. But, the property return to the
> > default value at run-time.

> > What's the problem?



Mon, 07 Feb 2005 22:57:02 GMT  
 Property return to default value at run-time in VB
How are your property getters and setters implemented? I mean
get_AppName, put_AppName, get_UserName, put_UserName. Are they being
called at all?
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> I am having trouble getting this same problem to work.  Here is my
property
> map:

>  BEGIN_PROP_MAP(CQualcommCtrl)
>   PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
>   PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
>   PROP_ENTRY("AppName", 1, CLSID_NULL)
>   PROP_ENTRY("UserName", 2, CLSID_NULL)
>   // Example entries
>   // PROP_ENTRY("Property Description", dispid, clsid)
>   // PROP_PAGE(CLSID_StockColorPage)
>  END_PROP_MAP()

> I added the PROP_ENTRY for UserName and AppName.  The DISPID's
correspond to
> the [id(n)] in the .idl file.  Both properties are of type BSTR if
that
> makes any difference.  Now I rebuild my ActiveX control and in eVB
type
> anything in for either of the properties and it still goes back to a
blank
> string after I press enter.  Am I leaving something out?  Project is
an ATL
> COM AppWizard for eVC++3.0 I inserted the control using the ATL Wizard
and a
> "Full control".



> > You are not persisting the property. List it in a property map - see
> > BEGIN_PROP_MAP, PROP_ENTRY, END_PROP_MAP.
> > --
> > With best wishes,
> >     Igor Tandetnik

> > "For every complex problem, there is a solution that is simple,
neat,
> > and wrong." H.L. Mencken



> > > Hi,

> > > I have a control which has only 1 property. I can change the
property
> > at
> > > design-time in a simplest VB project. But, the property return to
the
> > > default value at run-time.

> > > What's the problem?



Mon, 07 Feb 2005 23:11:03 GMT  
 Property return to default value at run-time in VB
Ahh, thank you Igor, while you did not provide a direct answer you did get
me on the right path.  The get_, put_ functions were being called, but since
this is a Windows CE ActiveX control I have to have 2 versions compiled, 1
for the Desktop with MSVC++6 (for design mode), and the other for the CE
device with eVC++3.  I had the code #ifdef'd out in my Win32 build when I
removed the #ifdef my properties are now persistant thanks!


Quote:
> How are your property getters and setters implemented? I mean
> get_AppName, put_AppName, get_UserName, put_UserName. Are they being
> called at all?
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > I am having trouble getting this same problem to work.  Here is my
> property
> > map:

> >  BEGIN_PROP_MAP(CQualcommCtrl)
> >   PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
> >   PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
> >   PROP_ENTRY("AppName", 1, CLSID_NULL)
> >   PROP_ENTRY("UserName", 2, CLSID_NULL)
> >   // Example entries
> >   // PROP_ENTRY("Property Description", dispid, clsid)
> >   // PROP_PAGE(CLSID_StockColorPage)
> >  END_PROP_MAP()

> > I added the PROP_ENTRY for UserName and AppName.  The DISPID's
> correspond to
> > the [id(n)] in the .idl file.  Both properties are of type BSTR if
> that
> > makes any difference.  Now I rebuild my ActiveX control and in eVB
> type
> > anything in for either of the properties and it still goes back to a
> blank
> > string after I press enter.  Am I leaving something out?  Project is
> an ATL
> > COM AppWizard for eVC++3.0 I inserted the control using the ATL Wizard
> and a
> > "Full control".



> > > You are not persisting the property. List it in a property map - see
> > > BEGIN_PROP_MAP, PROP_ENTRY, END_PROP_MAP.
> > > --
> > > With best wishes,
> > >     Igor Tandetnik

> > > "For every complex problem, there is a solution that is simple,
> neat,
> > > and wrong." H.L. Mencken



> > > > Hi,

> > > > I have a control which has only 1 property. I can change the
> property
> > > at
> > > > design-time in a simplest VB project. But, the property return to
> the
> > > > default value at run-time.

> > > > What's the problem?



Mon, 07 Feb 2005 23:27:29 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. GetClientRect returns different values each time app is run

2. Read/Write Properties During Design Time, but Read-Only During Run-Time

3. Design time properties at run time...

4. default value for custom component properties

5. Properties, default value

6. Property default value

7. Default return value=0

8. Distinguish the default value from an assignment in fields and properties

9. Default Run-Time Exception handling - Help...

10. Get return value from VB?

11. Returning a variant value from VC++ to VB

12. Returning a value from a VC++ COM to VB

 

 
Powered by phpBB® Forum Software