MATableComponent - using condition on cells

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MATableComponent - using condition on cells

cedreek
Hi

I'd like to be able to put condition on cells of my table. I want them
to be Number (float  between 0 and 1 or integer between 0 and 100).

So I changed the method buildDescriptionTable in MATableComponent (a copy of it)

buildDescriptionTable
        ^ self dataTable collect: [ :row :col :each |
                self description reference copy  "(-> return a MAStringDescription)"
                        accessor: MANullAccessor new;
                        label: row asString , '/' , col asString;
                        propertyAt: #row put: row;
                        propertyAt: #column put: col;
                        yourself ]

becomes:

buildDescriptionTable
        ^ self dataTable collect: [ :row :col :each |
                MANumberDescription new
                        accessor: (MABlockAccessor
                                read:  [ :model | (model memento cache at: (self description) )
at: row at: col ]
                                write: [ :model :object |  self halt. (model memento cache at:
(self description) )at: row at: col put: object]);
                        min: 0 max: 1;
                        label: row asString , '/' , col asString;
                        readonly: (col < row);
                        propertyAt: #row put: row;
                        propertyAt: #column put: col;
                        yourself ].

I think that instead of a NullAccessor and write:using: and readUsing:
which I removed, I can have a real accessor that can do the job. but
this doesn't really work :)

I'm sure I messed something with the memento (all table value are the
same now), so if you see something wrong in what I did, please tell
me.

Thanks,

Cédrick


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MATableComponent - using condition on cells

cedreek
I solved my problem by putting the condition on hte table. It's not
directly on the cell but that's ok for now...

Cédrick


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki