Hi Markus,

you mix up the facts. You must be sure that the setting is defined 
before using it. The "settings : {}" part defines the default value. It 
seems that the theme is loaded before your application. You can change 
this by adding a

/*
#require(custom.Application)
*/

to your theme class to force that this class is loaded before the theme 
class.

Hope this helps.

Sebastian


Markus Bäurle schrieb:
> Hi Sebastian,
> 
> I added the setting: { ... } declaration to the custom.Application class,
> but the error happens before the Application class is loaded:
> 
> When I want to define a custom IconTheme, the Settings are read in the
> icons: { ... } section of the theme and this is executed before the
> Application class is loaded:
> 
> qx.Theme.define("custom.MyIconTheme",
> {
>    title : "My Icon Theme",
> 
>    icons :
>    {
>       uri : qx.core.Setting.get("custom.resourceUri") + "/icon_path" // This
> line is evaluated before the Application class is loaded
>    }
> });
> 
> I understand the settings feature that it is possible to define settings
> before the application is loaded, to avoid hardcoding in the Application
> class and the window.qxsettings mechanism exactly does this, but
> unfortunately only the value and not the defaultValue is set.
> 
> Or is there another preferred way to define the uri of my IconTheme?
> 
> Regards,
> Markus
> 
> 
> 
> Sebastian Werner wrote:
>> The default setting is part of your part declaration:
>>
>> qx.Class.define("foo",
>> {
>>    settings : { "custom.resourceUri" : "" }
>>
>> });
>>
>> This is to protect the application from unwanted settings and also is 
>> helpful to omit typos etc. The empty string in this case is the default 
>> value. If you have a look at the skeleton: it should look identical there.
>>
>> Sebastian
>>
>>
>>
>> Markus Bäurle schrieb:
>>> Hi, 
>>>
>>> I have a problem with custom resources:
>>>
>>> The qx.core.Setting.__settings map does contain the "custom.resourceUri"
>>> key
>>> but there is no defaultValue assigned but only a value => Error Setting
>>> "custom.resourceUri" is not supported by API.
>>>
>>> The documentation says, that the window.qxsettings map is imported at
>>> application start. This happens in the qx.core.Setting.__init() method,
>>> but
>>> here only the value is set.
>>>
>>> How to set the defaultValue?
>>>
>>> The error is thrown, when the custom Widget-/IconTheme is loaded:
>>>
>>> qx.Theme.define("custom.MyIconTheme",
>>> {
>>>    title : "My Icon Theme",
>>>
>>>    icons :
>>>    {
>>>       uri : qx.core.Setting.get("custom.resourceUri") + "/icon_path" //
>>> This
>>> line causes the error
>>>    }
>>> });
>>>
>>>
>>>
>>> Regards,
>>> Markus
>>>
>>>
>>> Edit: I fixed it temorary by just switching lines 127 - 129 with 131 -
>>> 133
>>> in qx.core.Setting.get():
>>>
>>>     get : function(key)
>>>     {
>>>       var cache = this.__settings[key];
>>>
>>>       if (cache === undefined) {
>>>         throw new Error('Setting "' + key + '" is not defined.');
>>>       }
>>>
>>>       if (cache.value !== undefined) {
>>>         return cache.value;
>>>       }
>>>
>>>       if (cache.defaultValue === undefined) {
>>>         throw new Error('Setting "' + key + '" is not supported by
>>> API.');
>>>       }
>>>
>>>       return cache.defaultValue;
>>>     },
>>>
>>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems?  Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> qooxdoo-devel mailing list
>> qooxdoo-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to