[Laszlo-user] Gridtext and event dblclick...

Cary Clark caclark at cox.net
Thu Apr 13 21:40:05 EDT 2006


No, I'm not that one.  I'm the one that was born and raised right here 
in Oklahoma.  David Temkin or one of the other guys asked me about 
that.  And here I thought I had a pretty unique name....

Jim Grandy wrote:
> Thanks for filing. We do some proportion, but I'm always looking to 
> lighten that load a bit...
>
> As for contributing, that's fabulous! Amy Muntz (CC'd here) is the one 
> to help you through the process.
>
> By the way, are you the Cary Clark that worked at Apple in the early 90's?
>
> jim
>
> On Apr 13, 2006, at 4:16 PM, Cary Clark wrote:
>
>> No problem.  I'll try to do it tomorrow; I'm off my real job for Good 
>> Friday.  And, I've been meaning to submit a contributor's agreement 
>> for awhile now, just haven't slowed down to do it.  I have a cool 
>> subclass of grid & gridrow that I've been working on that I think 
>> others might use, too.
>>
>> Cary
>>
>>
>>
>> Jim Grandy wrote:
>>> Hey Cary,
>>>
>>> Would you mind filing a bug with this code? I'd like to make sure 
>>> this is fixed as well. Of course, we'll have to bug you for a 
>>> contributor's agreement if we take this code as is.
>>>
>>> On Apr 13, 2006, at 5:07 AM, Cary Clark wrote:
>>>
>>>> The dblclick doesn't fire for the grid or grid row.  IT REALLY SHOULD.
>>>> I got this code from a guy on one of the Laszlo forums and tweaked 
>>>> it a bit.  I forget his name, so credit goes to him whoever he is:
>>>>
>>>> <?xml version="1.0" standalone="no"?>
>>>> <!DOCTYPE canvas SYSTEM 
>>>> "http://www.laszlosystems.com/lps/tools/lzx.dtd" 
>>>> <http://www.laszlosystems.com/lps/tools/lzx.dtd>>
>>>>
>>>> <library>
>>>>     <include href="base/basegrid.lzx" />  
>>>>     <include href="lz/grid.lzx"/>
>>>>
>>>>     <class name="dcGrid" extends="grid">
>>>>
>>>>         <attribute name="lastSelectionTime" value="0"/>
>>>>         <attribute name="lastSelectedRow" value="-1"/>
>>>>         <attribute name="onRowDoubleClicked" value="null"/>
>>>>
>>>>         <method name="itemSelected" args="item" event="onselect">
>>>>             <![CDATA[
>>>>                 var selectionTime = (new Date).getTime() ;
>>>>                 var currentRow    = this.getIndexForItem(item) ;
>>>> //Debug.write( "dcGrid::itemSelected:  item: " + item ) ;
>>>> //Debug.write( "dcGrid::itemSelected:  currentRow: " + currentRow ) ;
>>>>                 if ( (selectionTime - this.lastSelectionTime) <= 
>>>> 500 //  adjust this as desired...
>>>>                   && currentRow == lastSelectedRow )
>>>>                 {
>>>>                     if(this.onRowDoubleClicked)
>>>>                         this.onRowDoubleClicked.sendEvent(item) ;
>>>>                 }
>>>>
>>>>                 this.lastSelectedRow = currentRow ;
>>>>                 this.lastSelectionTime = selectionTime ;
>>>>             ]]>
>>>>         </method>
>>>>
>>>>     </class>
>>>> </library>
>>>>
>>>> Here is a sample to list some users:
>>>> =======================
>>>>                 <dcGrid name="userGrid" 
>>>> datapath="local:classroot.getUsersDS:/Users" contentdatapath="User"
>>>>                         width="40%" height="100%" 
>>>> showhscroll="true" bgcolor="0xCAE1FF" >
>>>>
>>>>                     <method event="onRowDoubleClicked" 
>>>> args="selectedRow">
>>>>                         parent.viewingIndex = 
>>>> this.getIndexForItem(selectedRow) ;
>>>> //                        Debug.write('grid::onRowDoubleClicked:  
>>>> viewing index in ' + parent.name + ": " + parent.viewingIndex + " 
>>>> (" + this.lastSelectedRow + ")" );
>>>>                         //  Find the id of the selected row
>>>>                         var useridId = 
>>>> selectedRow.datapath.xpathQuery( "UserId/text()" ) ;
>>>> //                        Debug.write( "grid::onRowDoubleClicked:  
>>>> selectedRow.datapath: (" + selectedRow.datapath.class.name + ") " + 
>>>> selectedRow.datapath.serialize() ) ;
>>>>                         Debug.write( "grid::onRowDoubleClicked:  
>>>> selected user Id is " + userId ) ;
>>>>                         if ( userId.length > 0 )
>>>>                         {
>>>>                          //  Do whatever you want at this point; 
>>>> you have a valid user Id....
>>>>                         }
>>>>
>>>>                     </method>
>>>>
>>>>                     <gridcolumn width="${parent.width /2 }">Last Name
>>>>                       <text datapath="LastName/text()"/>
>>>>                     </gridcolumn>
>>>>                     <gridcolumn width="${parent.width /2 }">First Name
>>>>                         <text datapath="FirstName/text()"/>
>>>>                     </gridcolumn>
>>>>                 </dcGrid>
>>>>
>>>> Here's some sample XML
>>>> =======================
>>>> <Users>
>>>>     <User>
>>>>     <UserId>1</UserId>
>>>>     <FirstName>Donald</FirstName>
>>>>     <LastName>Duck</LastName>
>>>>     <Address1>1332 Fox Run</Address1>
>>>>     <Address2/>
>>>>     <City>Disneyland</City>
>>>>     <State>Confusion</State>
>>>>     <Zip>73003</Zip>
>>>>     <Country>USA</Country>
>>>>     <Phone1>405-123-4567</Phone1>
>>>>     <Phone2>405-780-3433</Phone2>
>>>>     <EmailAddress>xxx at yyyy.org <mailto:xxx at yyyy.org></EmailAddress>
>>>>     </User>
>>>> </Users>
>>>> =======================
>>>>
>>>> Luca Ritossa wrote:
>>>>> I'd like to intercept the dblclick event when I dblclick on a 
>>>>> grid's row.
>>>>>
>>>>> No success. Nothing happen.
>>>>>
>>>>> I've setted
>>>>>
>>>>>      code:  
>>>>>      
>>>>>        
>>>>>         Debug.write("double clicked");
>>>>>        
>>>>>      
>>>>>      
>>>>>
>>>>>
>>>>>
>>>>> I'm sure I forgot some code...
>>>>>
>>>>> Any suggestions will be appreciated.
>>>>>
>>>>> Luca Ritossa
>>>>>  _______________________________________________
>>>>> Laszlo-user mailing list
>>>>> Laszlo-user at openlaszlo.org <mailto:Laszlo-user at openlaszlo.org>
>>>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>>>>   
>>>> _______________________________________________
>>>> Laszlo-user mailing list
>>>> Laszlo-user at openlaszlo.org <mailto:Laszlo-user at openlaszlo.org>
>>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20060413/9c9cab5c/attachment.html


More information about the Laszlo-user mailing list