ActiveX Control Design-Time Properties 
Author Message
 ActiveX Control Design-Time Properties

I created an ActiveX Control in VB6 and everthing works great except for two
things:

1 - The properties window comes up at design time and I change properties and
these changes reflect in the control.  I have Private variables that store the
information whenever a property changes.  When I execute the program, all the
properties for my control return to the default values, so I have had to resort
to setting the properties at run-time.  How can I make the properties that I set
at design-time remain through run-time?

2 - One of the properties that I have is the font.  I set up the properties to be
of type 'stdFont'.  From the properties window, I can pull up the form that lets
you change the font, but when I click 'OK',  I get an error message stating
that 'Wrong number of arguments or invalid property assignment'.  Can someone
look at my code for this property and tell me what I'm doing wrong?

Public Property Get ButtonTextFont() As StdFont
    Set ButtonTextFont = lblBase.Font
End Property

Public Property Let ButtonTextFont(ByVal vNewValue As StdFont)
    lblBase.Font = vNewValue
End Property

Thanks,
Matt



Mon, 27 Oct 2003 20:21:08 GMT  
 ActiveX Control Design-Time Properties
1- Maybe you are not persisting the property values?
    Start a new ActiveX control project, add some other controls
    (Label, Textbox, button,...), use the ActiveX control interface
    wizard (Add-In) to map events and properties and then check the
    generated code.
    You'll find a UserControl_ReadProperties and a
    UserControl_WriteProperties procedure containing statements
    used to persist the properties in a property bag.

2 - StdFont is a class, therefore you need Property Set instead
    of Property Let

Public Property Set ButtonTextFont(ByVal vNewValue As StdFont)
    Set lblBase.Font = vNewValue
End Property

Before releasing your control, open the code window and select
'Procedure Attributes...' from the tools menu. There you can
- enter descriptions which then will appear in the object browser
- click Advanced and define certain properties/methods to be
   treated as some standard properties, like Caption, Enabled,....
   This will ensure your properties behave like you are used to.
- define the property's category
- hide a property
- define on which property page the property should appear

Hope this helps

Alex


I created an ActiveX Control in VB6 and everthing works great except for two
things:

1 - The properties window comes up at design time and I change properties
and
these changes reflect in the control.  I have Private variables that store
the
information whenever a property changes.  When I execute the program, all
the
properties for my control return to the default values, so I have had to
resort
to setting the properties at run-time.  How can I make the properties that I
set
at design-time remain through run-time?

2 - One of the properties that I have is the font.  I set up the properties
to be
of type 'stdFont'.  From the properties window, I can pull up the form that
lets
you change the font, but when I click 'OK',  I get an error message stating
that 'Wrong number of arguments or invalid property assignment'.  Can
someone
look at my code for this property and tell me what I'm doing wrong?

Public Property Get ButtonTextFont() As StdFont
    Set ButtonTextFont = lblBase.Font
End Property

Public Property Let ButtonTextFont(ByVal vNewValue As StdFont)
    lblBase.Font = vNewValue
End Property

Thanks,
Matt



Mon, 27 Oct 2003 21:01:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Saving properties of ActiveX control from design time to run time

2. Specifying design-time properties in ActiveX controls

3. Design-time properties in Run-time Controls

4. Yielding Design-Time Only properties with ActiveX

5. Detecting controls dropped into VB5.0 developed ActiveX control at design time

6. Custom Control with Design Time only properties

7. *** Refreshing control at design time when property changed?

8. DBCombo Control Crashes System at Design Time (Record Source Property)

9. Setting design-time properties of UserControl constituent controls

10. Design Time Controls Properties

11. Design Time Controls Properties

12. Crystal InterDev Design-Time ActiveX Control

 

 
Powered by phpBB® Forum Software