like :  test.Application.getInstance().reloadMap("Hello!");
(I do this from an Applet in case of any relevance)

2011/6/8 egamonal [via qooxdoo] <
[email protected]>

> how do you call this method?
> if it's a singleton, then you must get an instance before using any of its
> methods.
>
> Edu
>
>
> On Wed, Jun 8, 2011 at 15:26, Patrice Oostermeyer <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=6453667&i=0>
> > wrote:
>
>> Ok I have the ugly part working.
>> But I don't quite get the better approach.
>> I'm trying to call reloadMap from Application.js, which is of
>> type qx.application.Standalone.
>> I marked it "singleton", which seems to be no problem.
>> The call to reloadMap works, BUT in it is a reference to 'this', and that
>> is where it fails.
>> Any suggestions?
>>
>> qx.Class.define("test.Application",
>> { extend : qx.application.Standalone,
>>   type: "singleton",
>>
>>   members :
>>   {
>>      some:"bla",
>>     main : function() {...}
>>     reloadMap : function(msg)
>>     { this.some = "thensome";
>>       // crash when called outside this app.
>>       alert("ReloadMap says: " + msg + this.some);
>>     }
>>   }
>> }
>>
>> Regards,
>> Patrice
>>
>> 2011/6/1 Marc Puts <[hidden 
>> email]<http://user/SendEmail.jtp?type=node&node=6453667&i=1>
>> >
>>
>>> In the main() function of your application, you could set a global
>>> variable that calls the reloadMap function.
>>> Playground example:
>>>   http://tinyurl.com/3eth8of
>>>
>>> While the above works, it's pretty ugly.
>>>
>>> Another (and imo, better) approach would be to have the reloadMap()
>>> function in a singleton class:
>>>
>>> qx.Class.define("test.SomeClass",
>>> {
>>>   type: "singleton",
>>>   extend : qx.core.Object",
>>>
>>>   members :
>>>   {
>>>     reloadMap : function(msg)
>>>     {
>>>       alert("ReloadMap says: " + msg);
>>>     }
>>>   }
>>> }
>>>
>>> Then, from outside the application, you can write:
>>>    test.SomeClass.getInstance().reloadMap("Hello!");
>>>
>>>
>>>
>>> Regards,
>>> Marc
>>>
>>>
>>> On 06/01/2011 04:29 PM, ibanezje wrote:
>>> > Probably asked more than once,
>>> >
>>> > but how do I call a function in my main Application from outside the
>>> > application?
>>> > something like:
>>> >
>>> > fails.
>>> > reloadMap() is a function in the 'members' section of Application.js
>>> >
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Simplify data backup and recovery for your virtual environment with
>>> vRanger.
>>> Installation's a snap, and flexible recovery options mean your data is
>>> safe,
>>> secure and there when you need it. Data protection magic?
>>> Nope - It's vRanger. Get your free trial download today.
>>> http://p.sf.net/sfu/quest-sfdev2dev
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=6453667&i=2>
>>>
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> EditLive Enterprise is the world's most technically advanced content
>> authoring tool. Experience the power of Track Changes, Inline Image
>> Editing and ensure content is compliant with Accessibility Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> _______________________________________________
>>
>> qooxdoo-devel mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=6453667&i=3>
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>
> ------------------------------------------------------------------------------
>
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
>
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=6453667&i=4>
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://qooxdoo.678.n2.nabble.com/call-Application-function-from-outside-qx-app-tp6427159p6453667.html
>  To unsubscribe from call Application function from outside qx app, click
> here<http://qooxdoo.678.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6427159&code=aWJhbmV6amVAZ21haWwuY29tfDY0MjcxNTl8LTQ5MTg5Nzk5NQ==>.
>
>


--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/call-Application-function-from-outside-qx-app-tp6427159p6453687.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to