Results 1 to 7 of 7

Thread: OCX Settings

  1. #1

    Thread Starter
    Hyperactive Member New to VB 6's Avatar
    Join Date
    Apr 2002
    Posts
    362

    Question OCX Settings

    How do you give the user a choice of settings?

    i.e. Value1, value2, value3

    or 0 - Flat 1 - 3D

    You know in one of those little dropdown box's
    [VBCODE]
    Option Explicit
    Dim XXX As Porn
    Dim Wife As Nag

    Private Sub *****_Resize()
    On Error Resume Next
    Get Viagra
    End Sub
    [/VBCODE]

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    The way we get in VB intellisense?

    Use Enums
    Code:
    Public Enum MakeChoice
          LowLevel =0
           HighLevel = 1
    End Enum

  3. #3
    Fanatic Member
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    635
    You could create a poropertypage.
    A.A. Fussy
    Babya Software Group

  4. #4

    Thread Starter
    Hyperactive Member New to VB 6's Avatar
    Join Date
    Apr 2002
    Posts
    362
    I geuss I should have said ActiveX Control or User Control

    I also need to know where to put the "Enums"

    Here's some of my code

    VB Code:
    1. Private Sub UserControl_InitProperties()
    2. Caption = Ambient.DisplayName
    3. End Sub
    4.  
    5. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    6. 'MappingInfo=Label1,Label1,-1,ForeColor
    7. Public Property Get FontColor() As OLE_COLOR
    8.     FontColor = Label1.ForeColor
    9. End Property
    10.  
    11. Public Property Let FontColor(ByVal New_ForeColor As OLE_COLOR)
    12.     Label1.ForeColor() = New_ForeColor
    13.     PropertyChanged "FontColor"
    14. End Property
    15.  
    16. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    17. 'MappingInfo=Label1,Label1,-1,Font
    18. Public Property Get Font() As Font
    19.     Set Font = Label1.Font
    20. End Property
    21.  
    22. Public Property Set Font(ByVal New_Font As Font)
    23.     Set Label1.Font = New_Font
    24.     PropertyChanged "Font"
    25. End Property
    26.  
    27. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    28. 'MappingInfo=Label1,Label1,-1,Caption
    29. Public Property Get Caption() As String
    30.     Caption = Label1.Caption
    31. End Property
    32.  
    33. Public Property Let Caption(ByVal New_Caption As String)
    34.     Label1.Caption() = New_Caption
    35.     PropertyChanged "Caption"
    36. End Property
    37.  
    38. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    39. 'MappingInfo=Check1,Check1,-1,Value
    40. Public Property Get FontStyle() As Integer
    41.     FontStyle = Check1.Value
    42. End Property
    43.  
    44. Public Property Let FontStyle(ByVal New_Style As Integer)
    45.     Check1.Value() = New_Style
    46.     PropertyChanged "FontStyle"
    47. End Property
    48.  
    49. 'Load property values from storage
    50. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    51.  
    52.     Label1.ForeColor = PropBag.ReadProperty("FontColor", &H80000012)
    53.     Set Label1.Font = PropBag.ReadProperty("Font", Ambient.Font)
    54.     Label1.Caption = PropBag.ReadProperty("Caption", "Label1")
    55.     Check1.Value = PropBag.ReadProperty("FontStyle", 1)
    56. End Sub
    57.  
    58. 'Write property values to storage
    59. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    60.  
    61.     Call PropBag.WriteProperty("ForeColor", Label1.ForeColor, &H80000012)
    62.     Call PropBag.WriteProperty("Font", Label1.Font, Ambient.Font)
    63.     Call PropBag.WriteProperty("Caption", Label1.Caption, "Label1")
    64.     Call PropBag.WriteProperty("FontStyle", Check1.Value, 1)
    65. End Sub
    [VBCODE]
    Option Explicit
    Dim XXX As Porn
    Dim Wife As Nag

    Private Sub *****_Resize()
    On Error Resume Next
    Get Viagra
    End Sub
    [/VBCODE]

  5. #5
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    Using Enums:

    VB Code:
    1. Public Enum MyEnum
    2.  
    3. End Enum

  6. #6
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    Using Enums:

    VB Code:
    1. Public Enum MyEnum
    2.              FirstValue = 1
    3.               SecondValue = 2
    4. End Enum
    5.  
    6. Public Function MyFun(byval VauesExpected as MyEnum) as Whatever
    7. 'Code
    8. end Function

  7. #7
    Junior Member
    Join Date
    Feb 2002
    Posts
    27

    Re: OCX Settings

    If you want to name an enum that is normally invalid (e.g 3D or a name with spaces such as Fixed Single) enclose the value in square brackets: -

    Public MyEnum
    None
    [Fixed Single]
    End Enum

    Public MyEnum2
    Flat
    [3D]
    End Enum

    The above are of course 0 and 1 in each case but you can number them as you wish like the MousePointer property in most controls has a Custom property equal to 99 - just specify this in the enum : -

    Public MyEnum3
    Default
    .
    .
    .
    [Size All]
    Custom = 99
    End Enum

    (Sorry don't know how to indent)

Posting Permissions

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



Click Here to Expand Forum to Full Width