[Seaside] Change normal button for colour (again)
Philippe Marschall
philippe.marschall at gmail.com
Sat Jun 9 13:01:50 UTC 2007
2007/6/4, Rubén Parra Savall <kenterish at hotmail.com>:
>
> Thanks for trying to help me before, but I proved everything was in my scope
> and it was impossible to solve my problem yet. Maybe the code clarify
> more.(Omit the unnecessary for this case)
>
> I have the main renderContentOn that calls renderCell
>
> renderContentOn:html
> html table: [
> 1 to: 10 do: [ :row |
> html tableRow: [
> 1 to: 10 do: [ :col |
> html tableData: [ self renderCell: row @ col on: html ] ] ] ] ] .
>
>
> Each cell has a value, at first is zero, but if you submit the button, it
> changes, and with this, here we have the point, it should change of colour
> or stay with another if the value isn't changed. Now just show the value
>
>
> renderCell: aPoint on: html
> | value |
> value := self model boardAt2: aPoint. "Method to extract the value of the
> point in the array"
>
>
> html submitButtonWithAction: [
> value isZero ifTrue: [ bool := (self model checkValue: aPoint).
> (bool == true) ifTrue: [ self model boardAt2: aPoint put: 1.
>
> self answer: self model. ]
> ifFalse: [ self inform: ' Error'. ] .
> ]
> ifFalse: [ self inform: ' Error '. ] .
> ]
> text: (value isZero
> ifTrue: [ ' ' ]
> ifFalse: [ value ] ) .
>
>
> Thanks very much, any help is more than welcome
> Rubén
Sorry for not answering earlier, screw my telco.
The trick is to defina a CSS class for every possible value.
cssClass := self cssClassFor: value.
html submitButton
class: value; "if value is a string"
callback: [ ... ];
text: ....
if you still use the awkward old rendering API
html cssClass: cssClass.
html
submitButtonWithAction: [ ]
text: ...
and then in your Css have
.value1 {
background-color: red;
}
.value2 {
background-color: black;
}
Cheers
Philippe
_________________________________________________________________
> Un amor, una aventura, compañía para un viaje. Regístrate gratis en MSN Amor
> & Amistad. http://match.msn.es/match/mt.cfm?pg=channel&tcid=162349
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
More information about the Seaside
mailing list