Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locate a Control
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01045768
Message ID:
01045789
Views:
22
>>Dear All,
>>
>>I've got several label for Sun to Sat, I would like to highlight the day of Today, like so
>>
>>I want to use substitue like this:
>>
>>X = DOW(Date())
>>Thisform.Datelabel(X).background = RGB(0,0,255)
>>
>>
>>Anything wrongs?! cos I couldn't
>
>You can name the labels as follows: the label that is represent Monday name it Label1, Tuesday ->Label2 etc.
>Then
>
>X = DOW(Date(),2)
>myLabel = [Thisform.Label]+TRANSFORM(x)
>&myLabel..BackColor = RGB(0,0,255)
>
Minor suggestion to that:
X = DOW(Date(),2)
store rgb(0,0,255) to  ([Thisform.Label]+TRANSFORM(x)+ '.BackColor')
E.g. in this case you don't need to use macro.

If you need to invoke a method, then I usually do:

luRetVal = evaluate(([Thisform.Label]+TRANSFORM(x)+ '.MyMethod()')

And if you need to do lots of things with that object, you can do
loLabel = evaluate(([Thisform.Label]+TRANSFORM(x))

with loLabel
   .visible = .t.
   .backcolor = ...
   .refresh()
endwith
I dislike macros if they used in the context they should not be used. It makes code harder to maintain...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform