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?
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"
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