Closed Nyan11 closed 1 month ago
I manage to do it:
self
select: (ToCheckbox asTypeSelector
exact: false;
yourself)
style: [
self when: ToCheckedLookEvent do: [ :e | e requestNewSkin ].
self when: ToUncheckedLookEvent do: [ :e | e requestNewSkin ].
self select: [ :e | e isChecked ] asActionSelector style: [
self
when: ToHoveredLookEvent
write: (self property: #'background-color')
with: [ :e | Color green muchLighter ]
animation: nil.
self
when: ToInstallLookEvent
write: (self property: #'background-color')
with: [ :e | Color green ]
animation: nil.
self
when: ToLeavedLookEvent
write: (self property: #'background-color')
with: [ :e | Color green ]
animation: nil ].
self select: [ :e | e isChecked not ] asActionSelector style: [
self
when: ToInstallLookEvent
write: (self property: #'background-color')
with: [ :e | Color red ]
animation: nil.
self
when: ToHoveredLookEvent
write: (self property: #'background-color')
with: [ :e | Color red muchLighter ]
animation: nil.
self
when: ToLeavedLookEvent
write: (self property: #'background-color')
with: [ :e | Color red ]
animation: nil ] ]
But i have to force the request of new skin:
self when: ToCheckedLookEvent do: [ :e | e requestNewSkin ].
self when: ToUncheckedLookEvent do: [ :e | e requestNewSkin ].
And also use action selector to determine the current state:
self select: [ :e | e isChecked ] asActionSelector style: [ "..." ].
self select: [ :e | e isChecked not ] asActionSelector style: [ "..." ]
I think it is too complicated.
I think something simplier would be better.
With State as selector:
self select: (ToCheckbox asTypeSelector exact: false; yourself) style: [
self select: ((ToCheckState new checked: true; yourself) asStateSelector) style: [
"rules for ToCheckbox and selected"
].
self select: ((ToCheckState new checked: false; yourself) asStateSelector) style: [
"rules for ToCheckbox and unselected"
].
]
good example. but finally what you want seems to be the checkbox skin that already exists. I try to do it.
can we close this issue ?
Yes, you show me an example on how to do it
Hello,
I was working with StyleSheet and i wanted to create a Theme for radio button:
I'm not sure how to do it.
I think we need a selector for the states of elements.