[Xerte] Re: Xerte2 stylesheets

Julian Tenney Julian.Tenney at nottingham.ac.uk
Thu Mar 24 09:30:58 GMT 2011


Try the attached.

loadStyleSheet(yourCSSfile)

//code for reference

INTERFACE.prototype.loadStyleSheet = function(css){

     engine.css = new TextField.StyleSheet();
     engine.css.load(expression(css, engine));
     engine.css.rootIcon = this; //so we know what to referesh later.

     engine.css.onLoad = function(){
           //add any styles from the LOs stylesheet
           var temp = this.css.getStyle('colourScheme');
           for (var i in temp){
                debug(i);
                STYLES[i] = temp[i];

                //refresh the page
                this.rootIcon.closePage();
                intID = setInterval(this.rootIcon, 'refreshPage', 50);

           }
     }
}

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Tom Reijnders
Sent: 24 March 2011 09:29
To: Xerte discussion list
Subject: [Xerte] Re: Xerte2 stylesheets

Thank you Julian,

Of course I will gladly test it... :-)

Now I also undestand what's happening. I was wondering where the stylesheet was supposed to end up in the STYLES object, now I understand.
I suppose that after the test is succesfull, you'll make the .fla available through svn.

Tom


Op 24-3-2011 10:22, Julian Tenney schreef:
Ah, I see what you mean now.

When you load a stylesheet into TextField.stylesheet (note the class property), all text fields take on the new styles when the sheet loads. There's no need to handle the onLoad - the new styles are set automatically.

So, the reason we had an issue yesterday is because if there is a stylesheet attached to a LO, I just let it load. I didn't handle onLoad, as there was no need to: once the sheet had loaded the new styles would be set for all text fields.

That's OK, UNLESS you want to use some of those styles in the theme. Those styles are not set when TextField.stylesheet loads, as TextField knows nothing of Xerte.

So, what I did was make sure that if a stylesheet and / or templateData were being loaded, to make sure both had loaded before parsing the rlo file.

Then, in the parse, I do this to get the styles:

                                var temp = this.css.getStyle('colourScheme');
                                for (var i in temp){
                                                debug(i);
                                                STYLES[i] = temp[i];
                                }

This sets the style values on Xerte's internal STYLES object.

If you load a new stylesheet at runtime, you will also have to run that code once the sheet has loaded.

I think you will need some help in the engine, because that's going to be a PITA otherwise.

I will write a 'loadStylesheet' function for you in the engine, that will set the styles and refresh the current page. Maybe you can test it for me?

J

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Tom Reijnders
Sent: 24 March 2011 09:10
To: Xerte discussion list
Subject: [Xerte] Re: Xerte2 stylesheets

No... stylesheet is ignored.

Op 24-3-2011 9:59, Julian Tenney schreef:
I just fixed that: can you test the attached?

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Tom Reijnders
Sent: 24 March 2011 08:59
To: Xerte discussion list
Subject: [Xerte] Re: Xerte2 stylesheets

Thanks Julian,

Are the changes in svn? I've got the following problem:

1. It works in your example
2. It works also in a XOT or the Page Tempates when I specify a fixed file name for the stylesheet
3. It doesn't work if I try to set the stylesheet in the template wizerd, i.e. I add a combobox to the .xwd.

I am pretty sure that the style sheet is read before the xml templat data is loaded, but I can't find where this happens.

Tom


Op 23-3-2011 10:39, Julian Tenney schreef:

It works now: sorry, there were some timing issues with parsing the rlo file and loading up the styles info.



Try the attached,



J



-----Original Message-----

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Tom Reijnders

Sent: 23 March 2011 07:49

To: Xerte discussion list

Subject: [Xerte] Xerte2 stylesheets



The Page Templates use a stylesheet calle styles.css (in the common folder).



Some commented text in that file suggests that you can influence the

colours of the titlebar, statusbar, etc. Is that working, and if so how.

Whatever I try, I cannot get it to do anything...



Regards,



Tom









_______________________________________________

Xerte mailing list

Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk>

http://lists.nottingham.ac.uk/mailman/listinfo/xerte



This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.



This message has been checked for viruses but the contents of an attachment

may still contain software viruses which could damage your computer system:

you are advised to perform your own checks. Email communications with the

University of Nottingham may be monitored as permitted by UK legislation.









--

--



Tom Reijnders

TOR Informatica

Chopinlaan 27

5242HM Rosmalen

Tel: 073 5226191

Fax: 073 5226196




This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.





_______________________________________________

Xerte mailing list

Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk>

http://lists.nottingham.ac.uk/mailman/listinfo/xerte



This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.



This message has been checked for viruses but the contents of an attachment

may still contain software viruses which could damage your computer system:

you are advised to perform your own checks. Email communications with the

University of Nottingham may be monitored as permitted by UK legislation.








--

--



Tom Reijnders

TOR Informatica

Chopinlaan 27

5242HM Rosmalen

Tel: 073 5226191

Fax: 073 5226196







_______________________________________________

Xerte mailing list

Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk>

http://lists.nottingham.ac.uk/mailman/listinfo/xerte



This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.



This message has been checked for viruses but the contents of an attachment

may still contain software viruses which could damage your computer system:

you are advised to perform your own checks. Email communications with the

University of Nottingham may be monitored as permitted by UK legislation.





--

--



Tom Reijnders

TOR Informatica

Chopinlaan 27

5242HM Rosmalen

Tel: 073 5226191

Fax: 073 5226196


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110324/e80c6f45/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: XMLEngine.swf
Type: application/x-shockwave-flash
Size: 145261 bytes
Desc: XMLEngine.swf
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110324/e80c6f45/attachment-0001.swf>


More information about the Xerte mailing list