Results 1 to 6 of 6

Thread: custom button caption issue

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Location
    Calgary
    Posts
    121

    Exclamation custom button caption issue

    I have created a custom button control with a caption property. When I am using this in another project, I am able to set the caption to whatever I want, and it shows correctly in design mode, however when I am running the project the button caption still shows as the default I have set on the control, how do I fix this?

    Here is my code on the control:
    VB Code:
    1. Public Event Click()
    2. Private lblCaption As String
    3.  
    4. Private Sub imgUp_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    5.     imgUp.Visible = False
    6.     imgDown.Visible = True
    7. End Sub
    8.  
    9. Private Sub imgUp_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    10.     imgUp.Visible = True
    11.     imgDown.Visible = False
    12.     RaiseEvent Click
    13. End Sub
    14.  
    15. Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    16.     imgUp.Visible = False
    17.     imgDown.Visible = True
    18. End Sub
    19.  
    20. Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    21.     imgUp.Visible = True
    22.     imgDown.Visible = False
    23.     RaiseEvent Click
    24. End Sub
    25.  
    26. Property Get Caption() As String
    27.     lblCaption = UserControl.Label1.Caption
    28. End Property
    29.  
    30. Property Let Caption(capt As String)
    31.    UserControl.Label1.Caption = capt
    32.    PropertyChanged "Caption"
    33. End Property

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Location
    Calgary
    Posts
    121
    anything? I still can't figure it out.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    ummm.... maybe I'm a bit thick, and it's been a while since I've done a proj like this, but don't you need to save the PropertyBag when setting the property and read the PropertyBag when initializing the control?

    I guess the question is, is that ALL of the code in the control?

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Location
    Calgary
    Posts
    121
    yes that is all the code I have in the control. This is the first custom control I have made... please help.

  5. #5
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343
    Here are some ideas

    You're probably using labels with the background set to transparent.
    If so, you the label event will only fire if they happen to be right on top of the text.
    If they slide off the text before they release you may not get the mouse up event.

    On the image events, the image will stop getting events as soon as you turn it invisible.
    The image that's made visible may not get the mouse up event because it never got the mouse down event.

    I could be wrong, but i think that's what's happening.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Location
    Calgary
    Posts
    121
    the clicking event is working properly. The issue is that when I change the caption (label) on the button, it shows the changes in Design mode, however when the system is compiled and running it no longer shows what I have changed the caption to, however the default. The onclick events still process.

    Thanks

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