>>
APLDN Home

>>
Events

>>
Trainings

>>
APL Books

>>
APLDN Links

>>
Discussion Groups

>>
Downloads

>>
Articles

>>
Library

>>
Learning Tools

>>
APLDN User IO

>>
APL2000.com




General

Author Thread: Pasting and calculating in the grid
Doug.Ostien
Pasting and calculating in the grid
Posted: Tuesday, December 19, 2006 12:16 PM (EST)

I am trying to conceive of a way to automatically recalculate the grid when a user pastes data into it using Ctrl+V. 

 

I cannot seem to use the onXPaste event to trigger my calculation function because, at that point, the new data has not yet been pasted into the grid and the calculation proceeds without it.

 

Using onXValueChange works to trigger the calculation, but it fires and calculates for each cell pasted, and I'd rather wait until all cells are pasted before calculating.

 

The solution is probably very simple and, if any of you know what it is, I'd appreciate hearing from you.

 

Many thanks for your help,

Doug Ostien


Comments:

Author Thread:
davin.church
Pasting and calculating in the grid
Posted: Tuesday, December 19, 2006 8:40 PM (EST)

What about using []WI 'Defer'... (perhaps during onXPaste?) to cause the recalculation to run at a later time?

     

Support
Pasting and calculating in the grid
Posted: Wednesday, December 20, 2006 5:27 PM (EST)

Doug:   Davin's suggestion may very well solve your problem.  But, if it doesn't, you can send a small example of what you're trying to accomplish to support@apl2000.com and we'll see if we can come up with a solution.

 

APL2000 Support

     

Doug.Ostien
Pasting and calculating in the grid
Posted: Saturday, December 23, 2006 11:47 AM (EST)

Thanks for the suggestions.  I haven't tried Davin's suggestion yet, but I will and let you know.

 

Doug Ostien

     

Doug.Ostien
Pasting and calculating in the grid
Posted: Friday, January 05, 2007 2:27 PM (EST)

I am happy to report that Davin's suggestion to use []wi 'Defer' in the onPaste event handler worked nicely to allow me to trigger my grid calculation method from within onPaste and have it call the calculation method after the handler has completed.  This means the data being pasted is in the grid for the calculation.

 

The Defer method has two cases: a simple and a complex.  The simple case does not work in my circumstances, but the more complex case does.  We learned this thanks to the persistent efforts of my colleague, Duncan McArthur, who pursued the matter after I had about given up.

 

Many thanks to both Davin and Duncan.

 

Doug

     



APL2000 Official Web Site

To err is human, but when the eraser wears out ahead of the pencil, you're overdoing it.
- Josh Jenkins

APLDN Home   |    |  Events   |  Trainings   |  APL Books   |  APLDN Links   |    |  Discussion Groups   |    |  Downloads   |  Articles   |  Library   |  Learning Tools   |  APLDN User IO   |  APL2000.com   |