For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > May 2004 > Missing custom properties in property pages wizard









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Missing custom properties in property pages wizard
Mark Meyers

2004-05-28, 4:30 pm

Hi;
This is my first attempt at a UserControl/ActiveX control. When I launch
the property pages wizard, I get nothing but Enabled and SelText in the list
of available properties. Where did all my other properties go? I started
the property pages wizard once, but cancelled, because I realized I had to
add more properties first before creating the property pages. There were
more properties showing before. Am I missing something really simple, or do
things get corrupted internally on this?

Here's the code for the control that I created with the ActiveX wizard that
I'm trying to make property pages for...

MultiPositionSwitch.ctl
-------------------------

Option Explicit
'Default Property Values:
Const m_def_LabelForeColor = &H80000012
Const m_def_PosForeColor = &H80000012
Const m_def_PosLabelForeColor = &H80000012
Const m_def_MidColor = &H8000000F
Const m_def_SelIndex = 0
Const m_def_SelText = ""
Const m_def_LabelBackColor = &H8000000F
Const m_def_PosBackColor = &H8000000F
Const m_def_PosLabelBackColor = &H8000000F
Const m_def_Enabled = True
'Property Variables:
Dim m_LabelForeColor As OLE_COLOR
Dim m_PosForeColor As OLE_COLOR
Dim m_PosLabelForeColor As OLE_COLOR
Dim m_MidColor As OLE_COLOR
Dim m_SelIndex As Long
Dim m_SelText As String
Dim m_LabelBackColor As OLE_COLOR
Dim m_PosLabelFont As Font
Dim m_PosBackColor As OLE_COLOR
Dim m_LabelFont As Font
Dim m_ValueFont As Font
Dim m_PosLabelBackColor As OLE_COLOR
Dim m_Enabled As Boolean
'Event Declarations:
Event Resize()
Event Click()
'

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=0,0,0,True
Public Property Get Enabled() As Boolean
Enabled = m_Enabled
End Property

Public Property Let Enabled(ByVal New_Enabled As Boolean)
m_Enabled = New_Enabled
PropertyChanged "Enabled"
End Property
'

'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
m_Enabled = m_def_Enabled
m_SelIndex = m_def_SelIndex
m_SelText = m_def_SelText
m_LabelBackColor = m_def_LabelBackColor
Set m_PosLabelFont = Ambient.Font
m_PosBackColor = m_def_PosBackColor
Set m_LabelFont = Ambient.Font
Set m_ValueFont = Ambient.Font
m_PosLabelBackColor = m_def_PosLabelBackColor
m_LabelForeColor = m_def_LabelForeColor
m_PosForeColor = m_def_PosForeColor
m_PosLabelForeColor = m_def_PosLabelForeColor
m_MidColor = m_def_MidColor
End Sub

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

m_Enabled = PropBag.ReadProperty("Enabled", m_def_Enabled)
UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
UserControl.ForeColor = PropBag.ReadProperty("ForeColor", &H80000012)
m_SelIndex = PropBag.ReadProperty("SelIndex", m_def_SelIndex)
m_SelText = PropBag.ReadProperty("SelText", m_def_SelText)
m_LabelBackColor = PropBag.ReadProperty("LabelBackColor",
m_def_LabelBackColor)
Set m_PosLabelFont = PropBag.ReadProperty("PosLabelFont", Ambient.Font)
m_PosBackColor = PropBag.ReadProperty("PosBackColor",
m_def_PosBackColor)
Set m_LabelFont = PropBag.ReadProperty("LabelFont", Ambient.Font)
Set m_ValueFont = PropBag.ReadProperty("ValueFont", Ambient.Font)
m_PosLabelBackColor = PropBag.ReadProperty("PosLabelBackColor",
m_def_PosLabelBackColor)
m_LabelForeColor = PropBag.ReadProperty("LabelForeColor",
m_def_LabelForeColor)
m_PosForeColor = PropBag.ReadProperty("PosForeColor",
m_def_PosForeColor)
m_PosLabelForeColor = PropBag.ReadProperty("PosLabelForeColor",
m_def_PosLabelForeColor)
m_MidColor = PropBag.ReadProperty("MidColor", m_def_MidColor)
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

Call PropBag.WriteProperty("Enabled", m_Enabled, m_def_Enabled)
Call PropBag.WriteProperty("BackColor", UserControl.BackColor,
&H8000000F)
Call PropBag.WriteProperty("ForeColor", UserControl.ForeColor,
&H80000012)
Call PropBag.WriteProperty("SelIndex", m_SelIndex, m_def_SelIndex)
Call PropBag.WriteProperty("SelText", m_SelText, m_def_SelText)
Call PropBag.WriteProperty("LabelBackColor", m_LabelBackColor,
m_def_LabelBackColor)
Call PropBag.WriteProperty("PosLabelFont", m_PosLabelFont, Ambient.Font)
Call PropBag.WriteProperty("PosBackColor", m_PosBackColor,
m_def_PosBackColor)
Call PropBag.WriteProperty("LabelFont", m_LabelFont, Ambient.Font)
Call PropBag.WriteProperty("ValueFont", m_ValueFont, Ambient.Font)
Call PropBag.WriteProperty("PosLabelBackColor", m_PosLabelBackColor,
m_def_PosLabelBackColor)
Call PropBag.WriteProperty("LabelForeColor", m_LabelForeColor,
m_def_LabelForeColor)
Call PropBag.WriteProperty("PosForeColor", m_PosForeColor,
m_def_PosForeColor)
Call PropBag.WriteProperty("PosLabelForeColor", m_PosLabelForeColor,
m_def_PosLabelForeColor)
Call PropBag.WriteProperty("MidColor", m_MidColor, m_def_MidColor)
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,BackColor
Public Property Get BackColor() As OLE_COLOR
BackColor = UserControl.BackColor
End Property

Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
UserControl.BackColor() = New_BackColor
PropertyChanged "BackColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,ForeColor
Public Property Get ForeColor() As OLE_COLOR
ForeColor = UserControl.ForeColor
End Property

Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
UserControl.ForeColor() = New_ForeColor
PropertyChanged "ForeColor"
End Property
'

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=13,0,0,
Public Property Get SelText() As String
SelText = m_SelText
End Property

Public Property Let SelText(ByVal New_SelText As String)
m_SelText = New_SelText
PropertyChanged "SelText"
End Property
'

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H8000000F&
Public Property Get LabelBackColor() As OLE_COLOR
LabelBackColor = m_LabelBackColor
End Property

Public Property Let LabelBackColor(ByVal New_LabelBackColor As OLE_COLOR)
m_LabelBackColor = New_LabelBackColor
PropertyChanged "LabelBackColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=6,0,0,0
Public Property Get PosLabelFont() As Font
Set PosLabelFont = m_PosLabelFont
End Property

Public Property Set PosLabelFont(ByVal New_PosLabelFont As Font)
Set m_PosLabelFont = New_PosLabelFont
PropertyChanged "PosLabelFont"
End Property
'

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H8000000F&
Public Property Get PosBackColor() As OLE_COLOR
PosBackColor = m_PosBackColor
End Property

Public Property Let PosBackColor(ByVal New_PosBackColor As OLE_COLOR)
m_PosBackColor = New_PosBackColor
PropertyChanged "PosBackColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=6,0,0,0
Public Property Get LabelFont() As Font
Set LabelFont = m_LabelFont
End Property

Public Property Set LabelFont(ByVal New_LabelFont As Font)
Set m_LabelFont = New_LabelFont
PropertyChanged "LabelFont"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=6,0,0,0
Public Property Get ValueFont() As Font
Set ValueFont = m_ValueFont
End Property

Public Property Set ValueFont(ByVal New_ValueFont As Font)
Set m_ValueFont = New_ValueFont
PropertyChanged "ValueFont"
End Property
'

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H8000000F&
Public Property Get PosLabelBackColor() As OLE_COLOR
PosLabelBackColor = m_PosLabelBackColor
End Property

Public Property Let PosLabelBackColor(ByVal New_PosLabelBackColor As
OLE_COLOR)
m_PosLabelBackColor = New_PosLabelBackColor
PropertyChanged "PosLabelBackColor"
End Property
'
'
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H80000012&
Public Property Get LabelForeColor() As OLE_COLOR
LabelForeColor = m_LabelForeColor
End Property

Public Property Let LabelForeColor(ByVal New_LabelForeColor As OLE_COLOR)
m_LabelForeColor = New_LabelForeColor
PropertyChanged "LabelForeColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H80000012&
Public Property Get PosForeColor() As OLE_COLOR
PosForeColor = m_PosForeColor
End Property

Public Property Let PosForeColor(ByVal New_PosForeColor As OLE_COLOR)
m_PosForeColor = New_PosForeColor
PropertyChanged "PosForeColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H80000012&
Public Property Get PosLabelForeColor() As OLE_COLOR
PosLabelForeColor = m_PosLabelForeColor
End Property

Public Property Let PosLabelForeColor(ByVal New_PosLabelForeColor As
OLE_COLOR)
m_PosLabelForeColor = New_PosLabelForeColor
PropertyChanged "PosLabelForeColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H8000000F&
Public Property Get MidColor() As OLE_COLOR
MidColor = m_MidColor
End Property

Public Property Let MidColor(ByVal New_MidColor As OLE_COLOR)
m_MidColor = New_MidColor
PropertyChanged "MidColor"
End Property



Mark Meyers

2004-05-28, 5:30 pm

Oh, I got it. They're all OLE_COLOR and Font types, and those only show up
in their property pages (which for colors I guess I would prefer using the
standard property list.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com