Oddness with view loading...

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

Oddness with view loading...

Mark Derricutt-2
Hey all - I've written myself a small I18N translation "framework" of
sorts and have a few issues I was hoping some more knowledgeable peeps
here could help me with...

First just a brief on the system.

I have a StringsFactory class which simply reads a file and populates a
Dictionary mapping keys to strings.

I've created subclasses of GroupBox, CheckBox, PushButton, StaticText,
Menu, MenuCommandItem etc. etc. which add a key variable, publish the
aspect, and hide the "text" or "description" aspects.

In these classes I've also redefined the getter of text/description to
return a the result of the key lookup in via the StringsFactory.

This all seems to work fine when running inside the environment, but
when running from an exported EXE, nothing seems get updated.

The StringsFactory caches the file contents and only reloads it if the
dictionary doesn't exist, the dictionary and access methods are class
methods on StringsFactory.

I don't have the code in front of me so can't check anything, but I've
just had a thought that maybe when I export to an EXE the dictionary
variable is being saved as being populated, so is never updated.

Does this sound probably?  (I'm sure it'll take me less than 30 seconds
to confirm/deny this the moment I get to the office, but I thought I'd
still post this post anyway)....


I guess the ultimate question here is - when exporting to an executable,
is the state of class variables saved along with the class?

Mark


Reply | Threaded
Open this post in threaded view
|

Re: Oddness with view loading...

Chris Uppal-3
Mark Derricutt wrote:

> I guess the ultimate question here is - when exporting to an executable,
> is the state of class variables saved along with the class?

Yes.  Unless you take active steps to avoid it, what's in the deployed image is
just a snapshot of the current state of the image you are deploying from (with
stuff stripped out, of course).

You might provide a class-side implementation of #onPreStripImage which
discards the unwanted cache.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Oddness with view loading...

talios@gmail.com
Cheers, thou it looks like that was only masking the real problem.

I'm overriding the accessor for text/description, but these don't seem
to be actually USED when showing my view.

If I have the view open in the view composer and select "File->Test" I
see my form open and its got the strings I expect from the returned
accessor, but if I open a workspace and execute "SMSComposerShell show"
then I get the strings that were used at the time I saved the resource.

I've tried adding an onFullyCreated method to the controls which simply
call "self text: self text" but that doesn't seem to do anything
either.

Grrrr
*takes a break for lunch and hopes something will drop into place when
I get back*


Reply | Threaded
Open this post in threaded view
|

Re: Oddness with view loading...

talios@gmail.com
Hazah - adding the other side of the accessor seems to hit the nail:

text: t
  super text: self text.

and we're away laughing ;-)