Results 1 to 6 of 6

Thread: at runtime write-protected properties do not occure at self-built controls

  1. #1
    Junior Member
    Join Date
    Aug 09
    Posts
    26

    at runtime write-protected properties do not occure at self-built controls

    Hallo,
    I built an own activeX control to add additional properties to the textbox control.
    But did anybody of you notice that ALL properties (of the textbox) that are write-protected at runtime do NOT appear in the properties list of my new control? So you cannot use this property anymore.
    It is very strange!

    E.g. in my case the property 'Multiline' is not shown.
    And if I try to add the specific code manually, e.g. with:
    Text1.MultiLine = New_MultiLine

    Then the compiler throws out the error:
    "Assignment to a write-protected property not possible". Strange because this equation should be possible - at design mode!!!

    Or does maybe anybody know where the write-protection information is saved (so that I could deactivate it)?

    Hope that anybody can explain what is going on here!?
    Thank you very much.

    Many greetings
    Last edited by Softterrier; Aug 12th, 2012 at 05:53 AM.

  2. #2
    PowerPoster
    Join Date
    Jun 01
    Location
    Trafalgar, IN
    Posts
    3,439

    Re: at runtime write-protected properties do not occure at self-built controls

    When you create an ActiveX control based on a constituent control the ActiveX control doesn't automatically inherit all the properties, methods and events of the constituent control. You have to map this yourself. Luckily VB has an add-in that makes that easier. It can be found on the add-in menu and is called "VB 6 ActiveX Ctrl Interface Wizard".

  3. #3
    Junior Member
    Join Date
    Aug 09
    Posts
    26

    Re: at runtime write-protected properties do not occure at self-built controls

    oh, I did all of that already, don't mind!
    (unfortunatelly the add-in does not offer for constituent controls the option: overtake all options (prop., meth., events). Never mind)

    And for the property Multiline the generator did not even create a let function !!
    When I do that manually (adding a let function - as I described at last) like:
    Text1.MultiLine = New_MultiLine
    an error is returned.
    I described that at last.

    So maybe you know now what I mean?...

  4. #4
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    Re: at runtime write-protected properties do not occure at self-built controls

    We would know alot better if you showed the code you have right now

  5. #5
    Junior Member
    Join Date
    Aug 09
    Posts
    26

    Re: at runtime write-protected properties do not occure at self-built controls

    I have shortened the code to the most important.
    Here it is:
    ******************************************
    'Ereignisdeklarationen:
    Event Click() 'MappingInfo=Text1,Text1,-1,Click
    Event DblClick() 'MappingInfo=Text1,Text1,-1,DblClick
    Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=Text1,Text1,-1,KeyDown
    Event KeyPress(KeyAscii As Integer) 'MappingInfo=Text1,Text1,-1,KeyPress
    Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=Text1,Text1,-1,KeyUp
    Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Text1,Text1,-1,MouseDown
    Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Text1,Text1,-1,MouseMove
    Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Text1,Text1,-1,MouseUp
    Event Change() 'MappingInfo=Text1,Text1,-1,Change
    Event Validate(Cancel As Boolean) 'MappingInfo=Text1,Text1,-1,Validate


    'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VERÄNDERN!
    'MappingInfo=Text1,Text1,-1,Enabled
    Public Property Get Enabled() As Boolean
    Enabled = Text1.Enabled
    End Property

    Public Property Let Enabled(ByVal New_Enabled As Boolean)
    Text1.Enabled() = New_Enabled
    PropertyChanged "Enabled"
    End Property

    'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VERÄNDERN!
    'MappingInfo=Text1,Text1,-1,Refresh
    Public Sub Refresh()
    Text1.Refresh
    End Sub

    Private Sub Text1_Click()
    RaiseEvent Click
    End Sub

    Private Sub Text1_DblClick()
    RaiseEvent DblClick
    End Sub

    'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VERÄNDERN!
    'MappingInfo=Text1,Text1,-1,MultiLine
    Public Property Get MultiLine() As Boolean
    MultiLine = Text1.MultiLine
    End Property

    ' This Property was NOT generated by the generator!
    Public Property Let MultiLine(ByVal New_Multiline As Boolean)
    If Ambient.UserMode Then Err.Raise 393
    Text1.MultiLine() = New_Multiline ' Problem!
    PropertyChanged "MultiLine"
    End Property

    'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VERÄNDERN!
    'MappingInfo=Text1,Text1,-1,Text
    Public Property Get Text() As String
    Text = Text1.Text
    End Property

    Public Property Let Text(ByVal New_Text As String)
    Text1.Text() = New_Text
    PropertyChanged "Text"
    End Property

    Private Sub Text1_Change()
    RaiseEvent Change
    End Sub

    Private Sub Text1_Validate(Cancel As Boolean)
    RaiseEvent Validate(Cancel)
    End Sub

    'Eigenschaften für Benutzersteuerelement initialisieren
    Private Sub UserControl_InitProperties()

    End Sub

    'Eigenschaftenwerte vom Speicher laden
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    Text1.MultiLine = PropBag.ReadProperty("MultiLine", False) ' Problem!
    End Sub

    Private Sub UserControl_Resize()
    Text1.Width = Width
    Text1.Height = Height
    End Sub

    'Eigenschaftenwerte in den Speicher schreiben
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("MultiLine", Text1.MultiLine, False)
    End Sub
    ****************************************

    The two lines that do not work I marked with 'Problem!'.
    Does this help you?...
    Last edited by Softterrier; Aug 17th, 2012 at 08:40 PM.

  6. #6
    Junior Member
    Join Date
    Aug 09
    Posts
    26

    Re: at runtime write-protected properties do not occure at self-built controls

    now did you check the code?
    Do you understand the problem now?...

    But I am afraid this problem cannot be solved!?
    My explanation: building own apps on top of existing (constituent c.) is dependant from the 'outside' parameter interface (properties, methods, events) of them.
    And this one does not seem to distinguish between design and run mode but only offers parameters of the run mode.
    Right?
    I cannot find another conclusion.

    What do you think?....
    Last edited by Softterrier; Aug 22nd, 2012 at 03:35 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •