You shouldn't need the getAttribute.  That is there for backwards  
compatibility from days gone by.  It should suffice to say;

   xp = datapath.xpath;

Also I like to tout the following features of the Debug(er).  If you  
say:

   Debug.write('this.datapath =', this.datapath);

It will output `this.datapath` in an 'inspectable' fashion.  You can  
click on it, and see its properties.  Which might have helped you  
find what you were looking for.  [By default, Debug.write will output  
all its arguments concatenated together with a space between each  
one.  By passing objects, they will be inspectable, whereas if you  
concatenate the string yourself, the debugger doesn't know what your  
objects were, so it can't offer inspection.]

Also, there is Debug.format.  You can say:

   Debug.format("this = %w, this.datapath = %w, this.datapath.xpath =  
%w\n", this, this.datapath, this.datapath.xpath);

Debug.format takes printf-like format strings.  %w says to print the  
object in an inspectable way.  (In Legal's, any of the formatting  
directives will print inspectably if the thing they are formatting is  
an object.  So for instance, %s will print a 'prettier' version of an  
object, but in a way that you can still click on it to inspect its  
innards.)

Hope that helps.

On 2006-10-04, at 13:55 EDT, William Krick wrote:

> THANK YOU SO MUCH!
>
> This was exactly what I needed...
>
> var dtpth = getAttribute('datapath');
> var xp = dtpth.getAttribute('xpath');
> Debug.write("xp = "+xp);
>
>
> ...
>
>
>
>
>
>
> -----Original Message-----
> From: William Powell [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 03, 2006 9:00 PM
> To: William Krick
> Subject: Re: [Laszlo-user] how do I get a datapointer from within a
> control?
>
>
>
> William
> This is an example of getting a string value of the
> datapath for the grid. I hope this helps.
>
> <grid bgcolor="0xFFFFFF" width="${parent.width}"
> height="${parent.height}" columns="6"
> style="silvercolors" multiselect="false"
> showhlines="true" showvlines="true"
> selectiontype="single" fontsize="8" fontstyle="bold"
> datapath="dsStanorde:/yrtotals">
>                                                               <gridtext 
> width="100" textalign="center"
> datapath="fr_yyyymm/text()" style="silvercolors"
> editable="false">From Year/Mth</gridtext>
>                                                               <gridtext 
> width="100" textalign="center"
> datapath="to_yyyymm/text()" style="silvercolors"
> editable="false">To Year/Mth</gridtext>
>                                                               <gridtext 
> width="100" textalign="right"
> datapath="no_inst/text()" style="silvercolors"
> editable="false">Month (s)</gridtext>
>                                                               <gridtext 
> width="100" textalign="right"
> datapath="mo_prin/text()" editable="false"
> datatype="number" style="silvercolors">Principle
> Amt</gridtext>
>                                                               <gridtext 
> width="100" textalign="right"
> datapath="mo_inte/text()" style="silvercolors"
> editable="false">Interest Amt</gridtext>
>                                                               <gridtext 
> width="100" textalign="right"
> datapath="mo_deduc/text()" style="silvercolors"
> editable="false">Total</gridtext>
>                                                               <method 
> event="oninit">
>                                                                       
> this.setVisible("true");
>                                                               </method>
>                                                               <method 
> event="ondata">
>                                                                       var 
> dtpth = getAttribute('datapath');
>                                                                       var xp 
> = dtpth.getAttribute('xpath');
>                                                                       
>                                                                       
> Debug.write("xp = "+xp);
>                                                               </method>
>                                                       </grid>
> --- William Krick <[EMAIL PROTECTED]> wrote:
>
>> Nope.
>>
>> Given a combobox named "cbyear", both...
>>
>> Debug.write(cbyear.xpath)
>> Debug.write(cbyear.parsedPath.path)
>>
>> ...print <<undefined>>
>>
>>
>>   -----Original Message-----
>>   From: Jason Stafford
>> [mailto:[EMAIL PROTECTED]
>>   Sent: Tuesday, October 03, 2006 2:16 PM
>>   To: William Krick
>>   Cc: Laszlo-User
>>   Subject: Re: [Laszlo-user] how do I get a
>> datapointer from within a
>> control?
>>
>>
>>   Depending on what you've got in your datapointers,
>> it seems like you could
>> use either the xpath or the parsed path.
>>
>>   Try:
>>
>> Debug.write( byear.xpath );
>> Debug.write( byear.parsedPath.path );
>> Seems like one of those should give you what you're
>> looking for.
>>
>>
>>   William Krick wrote:
>> Here's a fully working version with the paths
>> hard-coded.
>> You can see how ugly it is (and probably
>> inefficient).
>> If there were some way to grab the datapath of a
>> combobox as
>> _text_, then I could append to the path and use it
>> to set the
>> datapath of the next combobox.
>>
>>
>> The problem is, when you say something like...
>>
>> Debug.write( byear.getAttribute('datapath') );
>>
>> ...it prints the actual data that it's pointing to
>> in the dataset, not the path as text.  :(
>>
>> So, I'm not sure there's any way to get at the
>> datapath
>> as a string once you've set it.
>>
>>
>>
>> <canvas width="600" height="400">
>>
>>   <class name="textlistitemx"
>> extends="textlistitem">
>>     <method event="ondata">
>>       <!-- if I'm the first (or only) item in the
>> list, -->
>>       <!-- make my parent select me -->
>>       <![CDATA[
>>       if( !this['clonenumber'] || this.clonenumber
>> == 0 )
>>         this.parent.select(this);
>>       ]]>
>>     </method>
>>   </class>
>>
>>
>>   <dataset name="ds_symbols">
>>     <symbols>
>>       <year value="2007">
>>         <make value="AUDI">
>>           <model value="Q7 QUATTRO">
>>             <body value="UTL4X4 4 Dr">
>>               <vin value="WA1AV74L&amp;7"
>> symbol="23" />
>>               <vin value="WA1AV94L&amp;7"
>> symbol="24" />
>>               <vin value="WA1BV74L&amp;7"
>> symbol="24" />
>>               <vin value="WA1BV94L&amp;7"
>> symbol="25" />
>>             </body>
>>           </model>
>>         </make>
>>         <make value="CADILLAC">
>>           <model value="ESCALADE">
>>             <body value="UTL4X2 4 Dr">
>>               <vin value="1GY&amp;C638&amp;7"
>> symbol="23" />
>>             </body>
>>           </model>
>>           <model value="ESCALADE AWD">
>>             <body value="UTL4X4 4 Dr">
>>               <vin value="1GY&amp;K638&amp;7"
>> symbol="23" />
>>             </body>
>>           </model>
>>           <model value="ESCALADE ESV AWD">
>>             <body value="UTL4X4 4 Dr">
>>               <vin value="3GY&amp;K668&amp;7"
>> symbol="23" />
>>             </body>
>>           </model>
>>           <model value="ESCALADE EXT AWD">
>>             <body value="SUT4X4 4 Dr">
>>               <vin value="3GY&amp;K628&amp;7"
>> symbol="25" />
>>             </body>
>>           </model>
>>         </make>
>>       </year>
>>     </symbols>
>>   </dataset>
>>
>>   <datapointer name="dp1" />
>>
>>   <simplelayout axis="y"/>
>>
>>   <combobox editable="false" name="cbyear"
>> datapath="ds_symbols:/symbols">
>>     <method event="onselect">
>>       var dp = "ds_symbols:/symbols/" +
>>                "[EMAIL PROTECTED]'" + this.value + "']";
>>       parent.cbmake.setDatapath( dp );
>>     </method>
>>     <textlistitemx datapath="year"
>>       text="$path{'@value'}" value="$path{'@value'}"
>> />
>>   </combobox>
>>
>>   <combobox editable="false" name="cbmake"
>> datapath="" visible="true">
>>     <method event="onselect">
>>       var dp = "ds_symbols:/symbols/" +
>>                "[EMAIL PROTECTED]'" + parent.cbyear.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" + this.value + "']";
>>       parent.cbmodel.setDatapath( dp );
>>     </method>
>>     <textlistitemx datapath="make"
>>       text="$path{'@value'}" value="$path{'@value'}"
>> />
>>   </combobox>
>>
>>   <combobox editable="false" name="cbmodel"
>> datapath="" visible="true">
>>     <method event="onselect">
>>       var dp = "ds_symbols:/symbols/" +
>>                "[EMAIL PROTECTED]'" + parent.cbyear.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" + parent.cbmake.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" + this.value + "']";
>>       parent.cbbody.setDatapath( dp );
>>     </method>
>>     <textlistitemx datapath="model"
>>     text="$path{'@value'}" value="$path{'@value'}"
>> />
>>   </combobox>
>>
>>   <combobox editable="false" name="cbbody"
>> datapath="" visible="true">
>>     <method event="onselect">
>>       var dp = "ds_symbols:/symbols/" +
>>                "[EMAIL PROTECTED]'" + parent.cbyear.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" + parent.cbmake.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" +
>> parent.cbmodel.value + "']/" +
>>                "[EMAIL PROTECTED]'" + this.value + "']";
>>       parent.cbvin.setDatapath( dp );
>>     </method>
>>     <textlistitemx datapath="body"
>>     text="$path{'@value'}" value="$path{'@value'}"
>> />
>>   </combobox>
>>
>>   <combobox editable="false" name="cbvin"
>> datapath="" visible="true">
>>     <method event="onselect">
>>      var dp = "ds_symbols:/symbols/" +
>>                "[EMAIL PROTECTED]'" + parent.cbyear.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" + parent.cbmake.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" +
>> parent.cbmodel.value + "']/" +
>>                "[EMAIL PROTECTED]'" + parent.cbbody.value
>> + "']/" +
>>                "[EMAIL PROTECTED]'" + this.value +
>> "']/@symbol";
>>      parent.vsymbol.tsymbol.setDatapath( dp );
>>
> === message truncated ===>
>> _______________________________________________
>> Laszlo-user mailing list
>> [email protected]
>>
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user


_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to