View Full Version : Event Bug ?
hunterino
04-19-2005, 07:49 PM
I have been playing with <grid> and <gridtext> today, and I can't get grid text to give me any events. Here is my code that shows what I was trying to do, but, the onblur, onfocus, and onselect don't work
Any Suggestions would be appreciated
<canvas debug="true">
<dataset name="eventlist">
<events>
<event ids="1" >First</event>
<event ids="2" >Second</event>
<event ids="3" >Third</event>
<event ids="4" >Last</event>
</events>
</dataset>
<edittext id="textin" focustrap="true">OK this is a log one
<method event="onblur">Debug.write('onblur');</method>
<method event="onfocus">Debug.write('onfocus');</method>
</edittext>
<button onclick="Debug.write('----====oooOOOooo====---');"></button>
<grid id="el" datapath="eventlist:/events" height="80%" focustrap="true">
<gridtext width="190" datapath="text()" focustrap="true" text="Event">
<method event="onblur">Debug.write('onblur');</method>
<method event="onfocus">Debug.write('onfocus');</method>
<method event="onselect">Debug.write('onselect');</method>
</gridtext>
</grid>
<button onclick="textin.setText('Ok Allready')"></button>
<simplelayout axis="y"></simplelayout>
</canvas>
jeffburton
04-20-2005, 12:36 PM
I am having the same problem.
When I intercept the onselect method, I get the following message in the debugger when I click on a row:
base/basegrid.lzx:260: call to undefined method 'sendEvent'
jeffburton
04-20-2005, 01:50 PM
I finally skipped onselect event and intercepted the select method. You have to call super.select(sel) or the selection never gets done, but at least I can now get in front of the selection process.
edlftt
05-12-2005, 07:06 AM
Could you please post the code you used to intercept the select using super? Don't know if this is what I'm looking for but I'm trying to get a window to show up when clicking on a row.
Thank you,
Chris
edlftt
05-12-2005, 07:19 AM
Instead of adding the method to gridtext one must add it under text inside gridcolumn (even though onclick is shown as an inherited event of gridtext .. I still don't get it so if someone can explain that would be awesome).
Here it is. Instead of
------------------snip-------------------------
<grid datapath="contactsData:/*">
<gridtext editable="false" width="75"
datapath="position()" resizable="false">
Job No.
<method event="ondblclick">
canvas.mymodal.open();
</method>
</gridtext>
</grid>
------------------/snip-------------------------
use this:
------------------snip-------------------------
<grid datapath="contactsData:/*">
<gridcolumn> Job No.
<text datapath="position()">
<method event="onclick">
canvas.mymodal.open();
</method>
</text>
</gridcolumn>
</grid>
------------------/snip-------------------------
Chris
jsolan
03-16-2006, 05:58 AM
Is this an official bug?
Has/will it been fixed in 3.2?
I really need to listen for an onblur event of gridtext. Using an edittext wrapped in a gridcolumn doesn't keep the grid selection functionality. I'm getting tired of writing work arounds for things that should work, wether they are bugs or just poor implementations.
I think i might have some code somewhere that will select the current row when an checkbox is clicked. I suppose i could convert that to edittext if need be, but it doesn't even address the issue of the "mouseover" hilight that the grid does.
Anyone else have a work around for this problem? Or better yet a fix?
jcmaxx
03-16-2006, 02:58 PM
I don't know about onblur and onfocus but onselect works fine if you put it on the grid itself. I'm not an OOP expert but to me that is where it belongs. If I remember correctly, the argument passed to onselect is actually a pointer to the underlying LzDataElement for the selected row which is a nice plus.
Sorry for not being certain but I suspect the onblur and onfocus events of the edittext (or whatever class implements the selected row's editing component) were simply not exposed on the grid class. In this case, it would probably not take too much effort to modify the source for the grid or, possibly, to extend the grid class.
An initial idea might be to add the desired events to an extended version of grid. Find out the the internal name of the edit class and create a delegate which watches for the desired event. Have the function for the delegate fire your newly created grid level event. Just an idea for a place to start.
What we really need is a completely new grid, rethought from the ground up. Laszlo's biggest weakness is the lack of 3rd party components created specifically for it. I had hoped it would be more like Delphi with numerous new and improved components created by the community. Oh well...
jsolan
03-17-2006, 04:40 AM
Thanks for the reply.
Yes a new grid would be nice.
Indeed the onselect method works fine, but the lack of an onchange event forces me to write a work around to use onblur of the individual column. When that didn't work, i had to come up with a work around for my work around.
I'll take a look at the basegrid/gridtext code and see what i can find. If i find anything of significance I'll post it here.
sjardine
04-20-2006, 03:18 PM
I modified the gridtext adding an onchange event and text attribute. It will also convert to US currency format. It seems to be working but no guarantees.
Let me know if you find any problems. onchange only fires when the data actually changes not just onblur.
Steve
jsolan
04-24-2006, 04:57 AM
EXCELLENT!
Thanks a ton! You saved me a good bit of work as i was getting to this point rather soon.
pcawdron
02-12-2007, 02:49 AM
Even with the newgridtext, I still couldn't get an onfocus, onselect or onblur event to fire...
By the way, for anyone trawling through this post... the onselect event of a grid returns a basegridrow. There's no documentation on it but you can find it under lps/components/base/ and look at the code to see what attributes it has... I couldn't see any datapointers or anything associated with it.
If you use the newgridtext be sure to use handlers for your events, for example...
<newgridtext width="200" datapath="text()" onchange="Debug.write('onchange')"/>
Will NOT work... but...
<newgridtext datapath="text()" width="200" >
<handler name="onchange">
Debug.write('data changed', this.change)
</handler>
</newgridtext>
Will work...
Cheers,
Peter
pcawdron
02-12-2007, 03:00 AM
Oh.... and I don't know if anyone else has struggled with this, but when a user changes a value in the column, the column header changes as well (???)
pcawdron
02-12-2007, 03:08 PM
This version resolves the bug with changes to the data in the gridtext also changing the column headings...
Jabberwock
03-01-2007, 02:54 PM
Sjardine:
I've sent you a PM.
Thanks!
J Crowley
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.