Theme not set: ThemeResource will not be found. (theme://icon/foo.png)

Hi,

I’m having some problems with my theme, and the subject describes only one implication.

The very first line of my application’s init() is a setTheme(“footheme”) call, and indeed, my customlayout templates work fine from ITMILL/themes/footheme/layout/.

However, when I create a Button and set its icon with

button.setIcon(new ThemeResource("icon/foo.png"));

I get the subject’s error in the debug window, and the button shows in the UI but it has no icon. The icon image file exists and is a valid PNG.

There is also a second problem: footheme/styles.css is not used.

Any ideas?

Hi!

This should work. I just event verified it with a simple test. Can you provide a bit more information about your setup?

As the them css is not either loaded I believe you have a typo in your theme naming or something. With Firebug you can try to sneak into generated DOM to see the uri that is used for icon. It might give you a clue what is the problem.

matti

Hi,

I got everything working, thanks.

The problem with ThemeResource was that I’m using a custom html gateway (just like in the Reserver example), and I needed to specify my theme location in there, like this:


<script type="text/javascript">
	var itmill = {
		appUri:'/context/foo', pathInfo: '/', themeUri: '/context/ITMILL/themes/footheme'
};
</script>

Reserver does not do this, I guess because it doesn’t use any ThemeResources. Maybe the example should cover the above mechanic?

The CSS problem was solved by adding a reference to my styles.css in the html, like the Reserver example does:


<link rel="stylesheet" type="text/css" href="ITMILL/themes/footheme/styles.css">

Now everything works :smiley: