changing a magritte description dynamically

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

changing a magritte description dynamically

Nick
Hi,

I have a form that's using generated via Magritte descriptions. I'd like to be able to change the label on one of the fields dynamically. I thought I'd found the solution by overriding #description on the instance-side and editing the field's description as in:

description 
| description pricePerUnitDescription |
self halt.
description := super description.
pricePerUnitDescription := description detect: [:each| each accessor readSelector == #pricePerUnit]. 
self addCurrencyToDescriptionLabel: pricePerUnitDescription.

^ description 

However it seems that the description is cached so this method is rarely called.

Any thoughts on how to dynamically change the label in a magritte field greatly received.

Thanks

Nick 

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

Re: changing a magritte description dynamically

Lukas Renggli
On 11 June 2010 21:26, Nick Ager <[hidden email]> wrote:

> Hi,
> I have a form that's using generated via Magritte descriptions. I'd like to
> be able to change the label on one of the fields dynamically. I thought I'd
> found the solution by overriding #description on the instance-side and
> editing the field's description as in:
> description
> | description pricePerUnitDescription |
> self halt.
> description := super description.
> pricePerUnitDescription := description detect: [:each| each accessor
> readSelector == #pricePerUnit].
> self addCurrencyToDescriptionLabel: pricePerUnitDescription.
> ^ description
> However it seems that the description is cached so this method is rarely
> called.
> Any thoughts on how to dynamically change the label in a magritte field
> greatly received.

Only the description on the class-side is cached, the #description
method one the instance-side is called whenever a form, report, query,
... is made.

Lukas



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



--
Lukas Renggli
www.lukas-renggli.ch

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

Re: changing a magritte description dynamically

Nick

Only the description on the class-side is cached, the #description
method one the instance-side is called whenever a form, report, query,
... is made.

Lukas

Thanks Lukas. I fixed the problem by changing my code:

quotationsTable := MAReport rows: quotations description: IZQuotation description

to: 

quotationsTable := MAReport rows: quotations description: quotations first description

That is I'm now calling #description from the instance side rather than the class side. Made sense once I'd thought about it

Thanks

Nick

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