Re: crappy bug in extender
Thats because you dont have any Read & Write properties set...
Re: crappy bug in extender
Excuse me, I can't understand you. You mean that my ocx has to expose R/W properties in order for the extender to work?
Re: crappy bug in extender
I tried to add R/W properties and things didn't change...
Re: crappy bug in extender
Actually I discovered that the problem is not limited to the Extender object. If you create an ocx and write in its code
Code:
Private Sub UserControl_Resize()
Dim a As Control
For Each a In UserControl.Parent.Controls
Debug.Print a.ToolTipText 'or a.CausesValidation etc.
Next
End Sub
and then you change the relevant extender property of the ocx, it doesn't print the value you entered but the default value. And this doesn't happen everytime, but depending on the IDE history. I am totally in despair, seems like the ocx's extender properties can't be referenced inside the ocx code. I really need help to understand why... Please, somebody?:(
Re: crappy bug in extender
It's not really a bug, you are making two incorrect assumptions.
1. That an extender is available. Not all applications provide extenders and when they do, not all extenders offer the same properties. There is a minimum set of properties that extenders must provide; not sure if ToolTipText is one of them.
Anyway, this doesn't apply to your situation because VB does provide extenders. If you are ever interested whether one is provided or not, the usercontrol has a function
Usercontrol.ParentControls.ParentControlsType=vbExtender
2. And this is where your problem lies. The Extender isn't provided until the usercontrol is sited. You are only guaranteed that usercontrol is sited (i.e., placed on the form or in this case in an extender) in three events: InitProperties, ReadProperties & Show. If you want to access the extender do it in one of those events.
a. InitProperties occurs only once, the 1st time a control is created
b. ReadProperties occurs every time a created control is first loaded
Last but not least, a creator of many usercontrols in my time, I have learned to avoid the Extender for reason #1 above. I may be mistaken, but I doubt you absolutely need to reference the Extender, rather there are other ways to get what you want. If we knew why you are trying to get that info, we might be able to point you to those other ways.
Edited: Here is a great source regarding ins/outs of usercontrols: http://pntpm3.ulb.ac.be/Info/Activex/ch17.htm
Re: crappy bug in extender
Thank you for your reply. But are you saying that the usercontrol isn't necessarily sited on the Click, AccessKeyPress, MouseMove, KeyDown and so on events? They all occur after the Show event, so the control should be sited...
Re: crappy bug in extender
Should be. Take what I wrote as it was intended, keying on the word guaranteed. Can you access Extender in Resize event? Sure, after the uc has been sited but not before; therefore, not guaranteed. That same statement applies for every single event in the usercontrol and all the subs/functions/properties you eventually add to the usercontrol.
Anyway, did this tidbit of knowledge help you resolve your problem?
Re: crappy bug in extender
Sure it did. However I tried to reference the extender within the ReadProperties event and had the same problems as before. Seems like the UC is only sited after the first Show event.
Re: crappy bug in extender
When I used your project you included & simply moved the MsgBox command from Resize to ReadProperties, it displayed the tooltiptext.
Re: crappy bug in extender
The fact it did doesn't guarantee it always will. When the messagebox was in the Resize event, sometimes it did show the tooltiptext, but not always. The same probably applies to ReadProperties...