Hi Thomas,
2007/4/12, Thomas Fischer <th.-fischer(a)web.de>de>:
contains Magritte the functionality to define options
with different values
and labels
via MASingleOptionDescription? Like:
#('de' => 'Germany' 'gb' => 'Great Britain' )
this were not easily possible. In fact, the reference of your
description was converting the object to a string.
Now, I've just add #labelBlock: which will help you do that kind of thing:
(MASingleOptionDescription auto: 'country' label: 'Country' priority:
1)
reference: MANumberDescription new;
options: {1. 2. 3. 4};
default: 1;
labelBlock: [:value :reference | (value + 10) printString];
beRequired;
yourself
Here, elements are 1, 2, 3 or 4 and they are printed 11, 12, 13, 14.
To solve your problem, you may want to use a dictionary:
| dict |
dict := Dictionary new
at: 'de' put: 'Germany';
at: 'gb' put: 'Great Britain';
yourself.
^ (MASingleOptionDescription auto: 'country' label: 'Country' priority:
1)
reference: MAStringDescription new;
options: dict keys;
default: dict keys anyOne;
labelBlock: [:value :reference | dict at: value];
beRequired;
componentClass: MASelectListComponent ;
yourself
This has been implemented in Magritte-Model-dc.253 and Magritte-Seaside-dc.218.
Lukas: I will now comment the changes
--
Damien Cassou