Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with method
Message
 
 
To
01/03/2001 13:21:55
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00481050
Message ID:
00481062
Views:
11
A method is not just going to fire itself. I would put all code in a method of the FORM [e.g., RefreshLabels] and use a DO CASE construct. When something on the form is changed [at runtime] that would change the status of a label then call that method. Your Form's REFRESH might also call that method.

You also have to consider other containers on the form -- pageframes and containers. You might consider putting this code in a RefreshLabels method of these containers as well.

In your method, loop through all the form objects [see Controls or Objects collections]. When you find that particular label class, modify its color as needed.

Too bad labels do not have refresh methods. I have added a Refresh method to a label class, but VFP does not call it with just a generic ThisForm.Refresh(). A label refresh has to be explicitly called.

>I want to be able to set a label to one of the following 4 status:
>1 - "Ok" (need to change backcolor to green)
>2 - "To verify" (need to change backcolor to yellow)
>3 - "Invalid" (need to change backcolor to red)
>4 - "Read only" (need to change backcolor to blue)
>
>Then, I created a class with 4 methods (one for each status).
>*** FYI all methods are Public ***
>By example, in the ReadOnly method I put the following code:
>WITH THIS.lblResult
> .BackColor=RGB(255,0,0)
> .ForeColor=RGB(255,255,255)
> .Caption="Read only"
>ENDWITH
>DOEVENTS
>
>When I try to execute the method from the object instantiated,
>like this: MyObject.ReadOnly ----nothing happens
>I tried to put a DoDefault() in the parent method ----nothing happens
>
>What is the problem?
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform