PDA

View Full Version : Problems with "Basic Function"



biscuit314
19 Feb 2012, 9:22 AM
Things started well. I defined a couple of Basic Functions at the viewport level. I was able to call them using "this.funcname()"

But, when I tried to add a third, no go. The drag/drop operation appeared to succeed, but the third function did not appear. I was able to add as many funcs as I want to Application or Controller, but dragging from either of these to Viewport failed in the same way.

No problem, probably better at the Application level (in fact probably even better at the Controller level).

But I have tried every combination of everything I can think of but simply cannot call the function. Every attempt gives me "undefined" or "not a function".

I looked at the Touch YQL example and it seems simple: appname.app.funcname(). Nope. Nothing, not calls to Ext.getCmp(), not calls to varying depths of namespace/classname.

Please help!

(I've moved all the functionality into a separate file so this is less urgent - still curious)

aconran
20 Feb 2012, 7:25 AM
Could you give us a small example project that illustrates the problem?

biscuit314
20 Feb 2012, 10:28 AM
There are two problems

1) trying to add a third Basic Function to Viewport fails

I can't reproduce this in any other project but the one where I first experienced it. That project is not exotic in any way, but something must have gone awry along the way.



2) Calling Application or Controller "Basic Functions" Let's say I do the following:

create a brand new project (Ext 4.0)
set the Application name property to "foobar"
save the project as foobar.xds
drop a basic function to Application, set fn to "greet" and add "alert('hi');" to the code
drop a panel to Views, drop a button on the panel
add a "click" event handler to button

From there how do I call greet() ?

I tried

foobar.greet();
foobar.app.greet(); [as demonstrated in the YQL example project]
this.greet();

Finally, if I drop a Conroller onto Controllers and name it "abc", then drag/drop the greet function onto abc, how do I call greet() from there?

aconran
21 Feb 2012, 9:14 AM
From there how do I call greet() ?

There have been a few changes in Sencha Touch during the betas as to how to invoke those methods on the application. I can verify this but I think foobar.app.greet() is correct.




Finally, if I drop a Conroller onto Controllers and name it "abc", then drag/drop the greet function onto abc, how do I call greet() from there?

"from there" means what? You can access other controllers via this.getController('abc')