|
-
Jul 8th, 2004, 10:35 AM
#1
Thread Starter
Lively Member
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:
Public Event Click()
Private lblCaption As String
Private Sub imgUp_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgUp.Visible = False
imgDown.Visible = True
End Sub
Private Sub imgUp_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgUp.Visible = True
imgDown.Visible = False
RaiseEvent Click
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgUp.Visible = False
imgDown.Visible = True
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgUp.Visible = True
imgDown.Visible = False
RaiseEvent Click
End Sub
Property Get Caption() As String
lblCaption = UserControl.Label1.Caption
End Property
Property Let Caption(capt As String)
UserControl.Label1.Caption = capt
PropertyChanged "Caption"
End Property
-
Jul 8th, 2004, 11:33 AM
#2
Thread Starter
Lively Member
anything? I still can't figure it out.
-
Jul 8th, 2004, 11:53 AM
#3
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
-
Jul 8th, 2004, 11:57 AM
#4
Thread Starter
Lively Member
yes that is all the code I have in the control. This is the first custom control I have made... please help.
-
Jul 9th, 2004, 06:33 AM
#5
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.
-
Jul 9th, 2004, 07:51 AM
#6
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|