Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LABEL color class
Message
 
To
02/11/2004 08:49:48
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00951785
Message ID:
00956992
Views:
12
That's strange, I created a test form with a textbox, dropped a colorlabel object onto it. In both the textbox's keypress & valid I put:
"ThisForm.ColorLabel1.Caption = alltrim( This.Value )
thisform.refresh"
when I run the form and type in the textbox, nothing happens. Did you add anything else to your test form?


>Yes I did test it. I tested from textbox, and in the valid event I put:
>
>ThisForm.ColorLabel1.Caption = alltrim( This.Value )
>
>It works just fine. And I just tried from KeyPress event, it also works
>
>>Ok, I did as instructed. Did you test this out? It did not seem to have any effect. In both the activate and keypress of a form that I have that uses your class invokes this: "thisform.colorlabel1.caption=log_nbr", even though the log_nbr has advanced to the next record, the colorlabel1 still displays the orig log_nbr.
>>
>>
>>>Glad you solved the problem, but I need to say something. The class I gave you, only has a basic functionality. If you want to do more than that, such as changing the caption anytime you want (i.e.: when refreshing the form), you have to modify the class.
>>>
>>>Update:
>>>OK. Let's do this.
>>>- Open up the ColorLabel class
>>>- Add a method named "SetCaption"
>>>- Open the Init event, cut all the code there and paste to the SetCaption method
>>>- Add this code in the Init event:
>>>
>>>This.SetCaption()
>>>
>>>- From the Class menu, click on "Edit Property/Method.."
>>>- From the property dialog, Select Caption property then check on the "Assign Method", click on apply.
>>>- Now you have one more new method called "Caption_Assign". Put this code in that method:
>>>
>>>Local ln_X
>>>
>>>With This
>>>   If !(.Caption == vNewVal)
>>>      For ln_X = 1 to This.ControlCount
>>>         lc_Object = 'lblName' + alltrim(str( ln_X ))
>>>         .RemoveObject( lc_Object )
>>>      Next
>>>
>>>      .Caption = vNewVal
>>>      .SetCaption()
>>>   endif
>>>EndWith
>>>
>>>
>>>Now you can assign the caption anytime you want.
>>>
>>>HTH
"Build a man a fire, and he's warm for a day.
Set a man on fire, and he's warm for the rest of his life."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform