Write-Once description

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

Write-Once description

Pierce Ng-3
Hi all,

I am prototyping an idea using QCMagritte. First time trying QCMagritte.
First time using Magritte seriously, really. :-)

I have a need for a write-once description. Suppose my domain object has two
attributes: a label and a date. Here I want date to be write-once. Meaning,
when instantiating a new object using QCMagritte's add screen, I want to enter
the label and the date. Subsequently, when I edit that object through
QCMagritte, I want date to be read only.

I am ok to be able to change the date using an inspector within Smalltalk.

Here are some possibilities I see:

- Test for nil in the date setter and signal an error when not nil. This isn't
so nice because the UI should not allow the date to be edited in the first
place when it is no longer nil.

- Dynamically change the instance's date description to beReadonly once date
has been set. Is this considered good style?

Hints appreciated.

Pierce

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

Re: Write-Once description

Stephan Eggermont-3
You can set a property in the description

                readonly: (self date notNil);

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

Re: Write-Once description

Esteban A. Maringolo
2014-10-22 6:01 GMT-03:00 Stephan Eggermont <[hidden email]>:
> You can set a property in the description
>
>                 readonly: (self date notNil);


Or if you use a persistence based solution, with an ID per instance, you can do:

   aDescription readonly: self id notNil

Regards,


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

Re: Write-Once description

Pierce Ng-3
In reply to this post by Stephan Eggermont-3
On Wed, Oct 22, 2014 at 11:01:46AM +0200, Stephan Eggermont wrote:
> You can set a property in the description
> readonly: (self date notNil);

Nice and easy! Thanks!

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

Re: Write-Once description

Pierce Ng-3
In reply to this post by Esteban A. Maringolo
On Wed, Oct 22, 2014 at 10:35:28AM -0300, Esteban A. Maringolo wrote:
> Or if you use a persistence based solution, with an ID per instance, you can
> do:
>
>    aDescription readonly: self id notNil

I am prototyping with GOODS and may switch to something else like GLORP +
NBSQLite3 when the application takes shape. Does that make any difference?

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