|
List Info
Thread: method problem
|
|
| method problem |
  United States |
2007-04-06 23:35:47 |
|
| I am a newbie to OL (using it for the first day now) and I have a curious issue.
I am trying to make a "sign in" modal dialog box. I want this to be a class so that I can re-use it. I have the following code in a canvas: <class name="signinModalDialog" extends="modaldialog"> <method name="sendSigninData"> Debug.write("foo"); var p = new LzParam(); p.addValue("userName", userName.getText(), true); p.addValue("password", password.getText(), true); p.addValue("challenge", challenge.getText(), true); signinDS.setQueryString(p); signinDS.doRequest(); this.close(); </method> <form> <view> <text x="10" y="10">User ID</text> <edittext id="userName" x="100" y="10" /> <text x="10" y="40">Password</text> <edittext id="password" x="100" y="40" /> <text x="10" y="70" width="100" height="200" multiline="true">What is your pet's name</text> <edittext id="challenge" x="100" y="70" /> <button x="200" y="110" onclick="md.sendSigninData()">OK</button> </view> </form> </class>
<button onclick="md.open();">Show Modal Dialog</button> <signinModalDialog id="md" width="300" height="200" title="Sign In" />
Notice that the button (the highlighted line) makes a reference to the id of the instance of the class, from within the class. This works, but obviously isn't very reusable since any implementation of the class has to be named "md". I am not exactly sure why this works even, seems non-OO. But anything else I try causes a "method not found" error in the debugger. I have tried no reference, the class name reference, parent, super, canvas, and have no luck. What is the correct way to reference the method in the class from the button also in the class.
Thanks, Steven Melzer smmelzer  gmail.com" >smmelzer gmail.com
|
| Re: method problem |
  Hong Kong |
2007-04-06 23:46:53 |
Use classroot,
onclick="classroot.sendSigninData()"
David
Steven Melzer wrote:
> I am a newbie to OL (using it for the first day now)
and I have a
> curious issue.
>
> I am trying to make a "sign in" modal dialog
box. I want this to be a
> class so that I can re-use it. I have the following
code in a canvas:
> <class name="signinModalDialog"
extends="modaldialog">
> <method name="sendSigninData">
> Debug.write("foo");
> var p = new LzParam();
> p.addValue("userName",
userName.getText(), true);
> p.addValue("password",
password.getText(), true);
> p.addValue("challenge",
challenge.getText(), true);
> signinDS.setQueryString(p);
> signinDS.doRequest();
> this.close();
> </method>
> <form>
> <view>
> <text x="10"
y="10">User ID</text>
> <edittext id="userName"
x="100" y="10" />
> <text x="10"
y="40">Password</text>
> <edittext id="password"
x="100" y="40" />
> <text x="10" y="70"
width="100" height="200"
> multiline="true">What is your pet's
name</text>
> <edittext id="challenge"
x="100" y="70" />
> * **<**button **x**=**"200"
**y**=**"110"
>
**onclick**=**"md.sendSigninData()"**>**OK**<
;/**button**>*
> </view>
> </form>
> </class>
>
>
>
> <button onclick="md.open();">Show
Modal Dialog</button>
> <signinModalDialog id="md"
width="300" height="200"
title="Sign In" />
>
> Notice that the button (the highlighted line) makes a
reference to the
> id of the instance of the class, from within the class.
This works,
> but obviously isn't very reusable since any
implementation of the
> class has to be named "md". I am not exactly
sure why this works
> even, seems non-OO. But anything else I try causes a
"method not
> found" error in the debugger. I have tried no
reference, the class
> name reference, parent, super, canvas, and have no
luck. What is the
> correct way to reference the method in the class from
the button also
> in the class.
>
> Thanks,
> Steven Melzer
> smmelzer gmail.com <mailto:smmelzer gmail.com>
>
>
>
|
|
| Re: method problem |
  United States |
2007-04-07 10:13:49 |
|
| Thank you, that worked! I did not see any reference to classroot in the documentation. What is it exactly?
Steve On Apr 7, 2007, at 12:46 AM, David Russell wrote: Use classroot,
onclick="classroot.sendSigninData()"
David
Steven Melzer wrote: I am a newbie to OL (using it for the first day now) and I have a curious issue.
I am trying to make a "sign in" modal dialog box. I want this to be a class so that I can re-use it. I have the following code in a canvas: <class name="signinModalDialog" extends="modaldialog"> <method name="sendSigninData"> Debug.write("foo"); var p = new LzParam(); p.addValue("userName", userName.getText(), true); p.addValue("password", password.getText(), true); p.addValue("challenge", challenge.getText(), true); signinDS.setQueryString(p); signinDS.doRequest(); this.close(); </method> <form> <view> <text x="10" y="10">User ID</text> <edittext id="userName" x="100" y="10" /> <text x="10" y="40">Password</text> <edittext id="password" x="100" y="40" /> <text x="10" y="70" width="100" height="200" multiline="true">What is your pet's name</text> <edittext id="challenge" x="100" y="70" /> * **<**button **x**=**"200" **y**=**"110" **onclick**=**"md.sendSigninData()"**>**OK**</**button**>* </view> </form> </class>
<button onclick="md.open();">Show Modal Dialog</button> <signinModalDialog id="md" width="300" height="200" title="Sign In" />
Notice that the button (the highlighted line) makes a reference to the id of the instance of the class, from within the class. This works, but obviously isn't very reusable since any implementation of the class has to be named "md". I am not exactly sure why this works even, seems non-OO. But anything else I try causes a "method not found" error in the debugger. I have tried no reference, the class name reference, parent, super, canvas, and have no luck. What is the correct way to reference the method in the class from the button also in the class.
Thanks, Steven Melzer smmelzer  gmail.com < smmelzer  gmail.com" >mailto:smmelzer gmail.com>
Steven Melzer smmelzer  gmail.com" >smmelzer gmail.com
|
| Re: method problem |
  United States |
2007-04-07 11:07:25 |
|
| And to state what might be obvious to some but not others (a pattern!)
you can say classroot.classroot to easily branch up an object chain - especially to communicate with singletons above you:
<pane> <item> <display>
here you can from display say classroot.classroot.classroot to access some classes' data above you easily and dependably. I came across the need for this when building a multi-column browser for a database, where the structure looked like
<master container> <pane> <list of files> <pane> <list of files>
so that each file when clicked on could erase all the panes after it (that is, using LzNode .subviews to iterate through panes and deleting the ones after the pane where the file was clicked.
Thought someone would profit by this approach.
.j.
On Apr 7, 2007, at 12:46 AM, David Russell wrote: Use classroot,
onclick="classroot.sendSigninData()"
David
Steven Melzer wrote: I am a newbie to OL (using it for the first day now) and I have a curious issue.
I am trying to make a "sign in" modal dialog box. I want this to be a class so that I can re-use it. I have the following code in a canvas: <class name="signinModalDialog" extends="modaldialog"> <method name="sendSigninData"> Debug.write("foo"); var p = new LzParam(); p.addValue("userName", userName.getText(), true); p.addValue("password", password.getText(), true); p.addValue("challenge", challenge.getText(), true); signinDS.setQueryString(p); signinDS.doRequest(); this.close(); </method> <form> <view> <text x="10" y="10">User ID</text> <edittext id="userName" x="100" y="10" /> <text x="10" y="40">Password</text> <edittext id="password" x="100" y="40" /> <text x="10" y="70" width="100" height="200" multiline="true">What is your pet's name</text> <edittext id="challenge" x="100" y="70" /> * **<**button **x**=**"200" **y**=**"110" **onclick**=**"md.sendSigninData()"**>**OK**</**button**>* </view> </form> </class>
<button onclick="md.open();">Show Modal Dialog</button> <signinModalDialog id="md" width="300" height="200" title="Sign In" />
Notice that the button (the highlighted line) makes a reference to the id of the instance of the class, from within the class. This works, but obviously isn't very reusable since any implementation of the class has to be named "md". I am not exactly sure why this works even, seems non-OO. But anything else I try causes a "method not found" error in the debugger. I have tried no reference, the class name reference, parent, super, canvas, and have no luck. What is the correct way to reference the method in the class from the button also in the class.
Thanks, Steven Melzer smmelzer  gmail.com < smmelzer  gmail.com" >mailto:smmelzer gmail.com>
|
| Re: method problem |

|
2007-04-07 12:18:39 |
|
Just an extended FYI
A nice gottcha with the classroot object is with the datapath object and localdatasets. if you have a class with a local dataset Like the following <class name="foo"> <dataset name="bar"/>
<view name="a" datapath="local:classroot.bar:/"/>
<view name="b" >
<datapath xpath="local:classroot.bar:/"/>
</view>
</class>
In view "a" case it can reference the local dataset "bar". In view "b" case it cannot. a datapath does not get a classroot object assigned to it so you must use the following synatx
<view name="b" >
<datapath xpath="local:parent.classroot.bar:/"/>
</view>
Z
On 4/7/07, jamesr < circlecycle gmail.com">circlecycle gmail.com> wrote:
And to state what might be obvious to some but not others (a pattern!)
you can say classroot.classroot to easily branch up an object chain - especially to communicate with singletons above you:
<pane> <item> <display>
here you can from display say classroot.classroot.classroot to access some classes9; data above you easily and dependably. I came across the need for this when building a multi-column browser for a database, where the structure looked like
<master container> <pane> <list of files>
<pane> <list of files>
so that each file when clicked on could erase all the panes after it (that is, using LzNode .subviews to iterate through panes and deleting the ones after the pane where the file was clicked.
Thought someone would profit by this approach.
.j.
On Apr 7, 2007, at 12:46 AM, David Russell wrote:
Use classroot,
onclick="classroot.sendSigninData()"
David
Steven Melzer wrote: I am a newbie to OL (using it for the first day now) and I have a curious issue.
I am trying to make a "sign in" modal dialog box. I want this to be a class so that I can re-use it.
I have the following code in a canvas: <class name="signinModalDialog" extends="modaldialog"> <method name="sendSigninData">
Debug.write("foo"); var p = new LzParam(); p.addValue("userName",
userName.getText(), true); p.addValue("password", password.getText(), true); p.addValue("challenge",
challenge.getText(), true); signinDS.setQueryString(p); signinDS.doRequest();
this.close(); </method> <form> <view>
<text x="10" y="10">User ID</text> <edittext id="userName" x="100" y="10" />
<text x="10" y="40">Password</text> <edittext id="password" x="100" y="40" />
<text x="10" y="70" width="100" height="200" multiline="true">What is your pet's name</text>
<edittext id="challenge" x="100" y="70" /> * **<**button **x**=**"200" **y**=**"110" **onclick**=**"
md.sendSigninData()"**>**OK**</**button**>* </view> </form>
</class>
<button onclick="md.open
();">Show Modal Dialog</button> <signinModalDialog id="md" width="300" height="200" title="Sign In" />
Notice that the button (the highlighted line) makes a reference to the id of the instance of the class, from within the class. This works, but obviously isn't very reusable since any implementation of the class has to be named "md".
I am not exactly sure why this works even, seems non-OO. But anything else I try causes a "method not found" error in the debugger. I have tried no reference, the class name reference, parent, super, canvas, and have no luck.
What is the correct way to reference the method in the class from the button also in the class.
Thanks,
Steven Melzer
|
[1-5]
|
|