P
Pierre Archambault
Hi,
I have a UserForm wich contains 20 Labels that should react to the Click
event. All those Labels have the special effect "Raised". When the user
clicks on one of them, it sinks like a button "Sunken". This works fine but
what I want is that when the user clicks on another Label, the previous one
returns to its original state (Raised) while the actuel Label sinks
"Sunken".
First I wrote some code for each of the Labels to obtain the desired effect:
In the UserForm module:
Public MyObject As Control
Private Sub LabelA1_Click() 'For each Label (20 times)
Set MyObject = LabelA1
Call SinkLabel
End Sub
Then a procedure to go from "Raised" to "Sunken":
Public Sub SinkLabel()
Static PrevObject As Control
If MyObject.SpecialEffect = fmSpecialEffectSunken Then Exit Sub
MyObject.SpecialEffect = fmSpecialEffectSunken
If PrevObject Is Nothing Then
'Do nothing
Else
PrevObject.SpecialEffect = fmSpecialEffectRaised
End If
Set PrevObject = MyObject
End Sub
Now I want to use a class module to acheive the same goal, But it works only
for the Label on wich the users clicks. It looks like it's impossible to get
the previous Label regain the "Raised" state.
If someone has an idea... Thank you very much.
Pierre
I have a UserForm wich contains 20 Labels that should react to the Click
event. All those Labels have the special effect "Raised". When the user
clicks on one of them, it sinks like a button "Sunken". This works fine but
what I want is that when the user clicks on another Label, the previous one
returns to its original state (Raised) while the actuel Label sinks
"Sunken".
First I wrote some code for each of the Labels to obtain the desired effect:
In the UserForm module:
Public MyObject As Control
Private Sub LabelA1_Click() 'For each Label (20 times)
Set MyObject = LabelA1
Call SinkLabel
End Sub
Then a procedure to go from "Raised" to "Sunken":
Public Sub SinkLabel()
Static PrevObject As Control
If MyObject.SpecialEffect = fmSpecialEffectSunken Then Exit Sub
MyObject.SpecialEffect = fmSpecialEffectSunken
If PrevObject Is Nothing Then
'Do nothing
Else
PrevObject.SpecialEffect = fmSpecialEffectRaised
End If
Set PrevObject = MyObject
End Sub
Now I want to use a class module to acheive the same goal, But it works only
for the Label on wich the users clicks. It looks like it's impossible to get
the previous Label regain the "Raised" state.
If someone has an idea... Thank you very much.
Pierre