Results 1 to 11 of 11

Thread: crappy bug in extender

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    crappy bug in extender

    Hello everybody. I'm having a very hard time with an ocx. I need to make the tooltiptext of an inner control coincide with Usercontrol.Extender.ToolTipText but unfortunately I discovered that the Extender object is totally unreliable. Just try the attached project, open it, open first the form at design time, then launch it. You'll see that when you first open it in design mode, the tooltiptext is correctly visualized, then it becomes null string at run time, and from then on it stays null. Something similar happens to all extender properties, such as CausesValidation. If you try to retrieve them via extender, you get unreliable values. What can I do? I can only use the extender for my project. Thank you.
    Attached Files Attached Files

  2. #2
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: crappy bug in extender

    Thats because you dont have any Read & Write properties set...
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    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?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    Re: crappy bug in extender

    I tried to add R/W properties and things didn't change...

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    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?

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

    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
    Last edited by LaVolpe; May 29th, 2009 at 05:54 PM.
    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}

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    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...

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

    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?
    Last edited by LaVolpe; May 30th, 2009 at 10:51 AM.
    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}

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    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.

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

    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.
    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}

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    195

    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...

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