Results 1 to 4 of 4

Thread: [VB6] AboutBox Usercontrol Bug?

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    [VB6] AboutBox Usercontrol Bug?

    One can create a public sub that shows an about box (be it a form, API window, property page, etc) for usercontrols (uc)

    Ok, however, if the Default property of the uc has a property page, the about box does not show, rather the property page for the property identified as "Default" shows instead. I have provided a workaround, but am wondering if there is another way.

    For these tests, create a new usercontrol project. Then select menu: File|Add Project and choose EXE
    Edited: Per request a sample project is provided instead. Jump to bottom of posting.

    Test One
    1. Copy and paste the following code into the usercontrol
    Code:
    Public Sub ShowAbout()
        MsgBox "About Box"
    End Sub
    
    Public Property Get BColor() As OLE_COLOR
    
    End Property
    Public Property Let BColor(Color As OLE_COLOR)
    
    End Property
    2. Select menu Tools|Procedure Attributes
    3. Find BColor and click "Advanced" button
    4. Middle combobox, select "Standard Color"
    5. Find ShowAbout in combobox at top of window
    6. Left combobox, select "{AboutBox}" and click Ok button
    7. Close usercontrol design window(s), add usercontrol to Project2's Form
    8. Double click AboutBox and also BColor. You will get the msgbox as an about box and you will also get a separate property page for the BColor property.
    Tip: Change form's backcolor or uc's backcolor to make it easier to see.

    Test Two
    1. Close form's design window(s)
    2. Open the usercontrol's code window
    3. Select menu Tools|Procedure Attributes
    4. Find BColor and click "Advanced" button
    5. Left combobox, select "{Default}" and click Ok button
    6. Close usercontrol design window(s) and open Form in design view
    7. Double click AboutBox and also BColor. You will get property page only - bug?

    So, how do you show an about box and also have a property be identified as Default that displays a property page?

    Test Three
    Here's the workaround, though I am hoping someone points out a better method.
    This method results in creating a hidden new Default property that links to the property you wanted default to begin with. Since this new property is Default and does not have a property page; bug bypassed. FYI. The property name of Default below can literally be any name you wish and doesn't have to be named Default.
    1. Close form's design window(s)
    2. Open the usercontrol's code window
    3. Copy and paste this code
    Code:
    Public Property Get Default() As OLE_COLOR
        Default = Me.BColor
    End Property
    Public Property Let Default(Color As OLE_COLOR)
        Me.BColor = Color
    End Property
    4. Select menu Tools|Procedure Attributes
    5. Find BColor again and click "Advanced" button
    6. Set left combobox to "{None}" and hit the Apply button
    7. Find Default in combobox at top of window
    8. Set left combobox to "{Default}"
    9. Check the box that says: "Hide this Member" and click Ok button
    10. Close usercontrol design windows & open form in design view
    Now you have both the AboutBox and PropertyPage again. Is there a different way?
    Attached Files Attached Files
    Last edited by LaVolpe; Nov 28th, 2009 at 04:53 PM. Reason: clarified a couple of steps
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #2
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    Re: [VB6] AboutBox Usercontrol Bug?

    can you give me a project?
    (is for i see better what you mean)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [VB6] AboutBox Usercontrol Bug?

    I have included a sample project in my first post above. Comments are included in the example usercontrols.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    Re: [VB6] AboutBox Usercontrol Bug?

    i have tested and i sod 2 things:

    1 - if i change the property page(for ex: font) i can see these;
    2 - build another property and i do the same, but change property page to picture. and i sod these last one.
    yes... i belive that it's a bug\error.
    honestly... i'm glad that we can create our property pages
    VB6 2D Sprite control

    To live is difficult, but we do it.

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