>>
APLDN Home

>>
Events

>>
Trainings

>>
APL Books

>>
APLDN Links

>>
Discussion Groups

>>
Downloads

>>
Articles

>>
Library

>>
Learning Tools

>>
APLDN User IO

>>
APL2000.com




Announcements

Author Thread: New APLGrid 6.0 Features
Patrick.Parks
New APLGrid 6.0 Features
Posted: Friday, April 07, 2006 12:59 PM (EST)

I have received several private requests from members of this and other forums to list some of the new features that will appear in release 6.0 of the APLGrid object and have neglected doing so for too long.  But here we go... finally :-)

 

The following unordered list (another way of saying that is "off the top of my head") recalls the most important new features.  I apologize for the informality:

  • Scatter-point indexing has been added to allow you to reach cells in random locations (non rectangular and non contiguous) in a single WI call rather than having to iterate.  Rather than specifying a vector of indexes in the Rows and Cols arguments you instead specify a two-column matrix in the first argument (Rows) and a "missing value" second argument (Cols).  This denotes a request for indexing using a scattered rather than rectangular set of cells in the grid.  This also works in three dimensions for the xImage property (but in that case you specify a three-column matrix of indexes in the first (Places) argument and use a "missing value" in the 2nd and 3rd argument).  Scatter-point indexing works for both setting and referencing of properties.
  • Scatter-point indexing is especially useful in combination with the new xChanges property.  It returns a two-column matrix of cell indexes for all cells that have changed due to user input.  You can therefore easily find all changed cells when saving the grid and you only have to reference their values (rather than checking the values of all cells).  You can clear the changed flag of all cells by setting xChanges to an empty numeric matrix or vector.  This works nicely if the users does a Save of changes.  You can clear the changes flags and then continue allowing user to browse and edit the cells.
  • Grid virtualization allows very large grid sizes (in excess of 10 million cells) to be handled efficiently.  If works with two new properties (xVirtualMode and xVirtualParts) and one new event (onXVirtualLoad).  The event is fired whenever cell values are needed for display or for printing, clipboard, or xml operations.  But for cells that are not accessed their values never need to be loaded. 
  • Row defaults have been added.  You have always been able to set default values for the grid page or for specific column.  In this release I also added Row defaults so that you can specify attributes for all cells in a row.  One use for this is to highlight exceptional rows with a change in background color or other attribute.
  • Support has been added for clipboard cut, copy, and paste.  And this is fully integrated with virtual mode.
  • There is also support for "replication mode" which looks similar to excel's "fill mode" where you drag on the lower-right corner of the selection and can extend it to fill elements.  We do not provide a default action but instead fire an event (onXReplEnd) that you can handle to perform any kind of "replication" action you wish. 
  • Printing has also been substantially improved and simplified.  You can now make a named association with an APL printer object and the grid will automatically handle printing all pages and doing page ejects between them. 
  • Printing now supports much better scaling options including a xPrintZoom factor that lets you specify relative scaling between the screen and printer sizes (in the past the default was one logical inch on screen was mapped to one logical inch on printer and there was no override).  the xPrintZoom allows you to get any scaling you want for printing including fitting all selected cells to page, all selected columns to page, or all selected rows to page.
  • Print preview has also been refined and properly documented.
  • During potentially long running operations in large virtual grids (such as printing, cut/copy/paste of huge blocks of cells, and production of XML output) progress tracking events are fired that make it trivial to display progress gauges including cancel button.
  • Numeric values stored into cells programmatically sometimes lost precision due to rounding errors.  That's because they were stored internally in formatted text format rather than as numbers.  This has been changed so that if you set a numeric value into a cell that will be exactly the value you get back when referencing the cell unless the user edits the cell value (in which case we have to evaluate the user's input which is subject to rounding errors).
  • The xProtect property has been enhanced to allow more options for controlling how much protection applies to a cell.  You can protect a cell but allow mouse and keyboard events to be fired.  And you can allow a protected cell to be part of a selection rectangle when the DELETE key is pushed without it preventing other cells from being cleared.

Pat


Comments:

Author Thread:
Michael.Hughes
New APLGrid 6.0 Features
Posted: Wednesday, April 19, 2006 4:22 AM (EST)

Looks very good - I particularly like the improvements to printing

Is there an easy way to do a print preview of the grid

 

Thanks

     

Michael.Hughes
New APLGrid 6.0 Features
Posted: Wednesday, April 19, 2006 4:22 AM (EST)

Looks very good - I particularly like the improvements to printing

Is there an easy way to do a print preview of the grid

 

Thanks

     

Patrick.Parks
New APLGrid 6.0 Features
Posted: Wednesday, April 19, 2006 4:36 AM (EST)
Yes! The new documentation describes printing in much more detail than the previous documentation (including print preview). You still manage print preview using the xPrintWindow property and XPrintPage method. That part is trivially easy. But most of the work is in figuring out scaling (a new attribute was added to the xPrintMetrics property to help in these calcs) and in setting up the preview form and target window. So this does still take some work. But the new documentation gives two complete examples that should get you started.

     

Mike.Montgomery
New APLGrid 6.0 Features
Posted: Wednesday, April 19, 2006 5:01 AM (EST)

Does APLGrid 6.0 rely on APL+Win 6 or can I use it with APL+Win 5.2?  When will APL+Win 6.0 move from beta to production? 

     

Patrick.Parks
New APLGrid 6.0 Features
Posted: Wednesday, April 19, 2006 5:41 AM (EST)
Most of the new grid feature work with APL+Win 5.2 but some of the new printing features (such as the xPrinter property that associates a printer with the grid by name) only works with APL+Win 6.0. They are doing final testing of the APL+Win 6.0 setup program as we speak so the release should happen within a few days.

     

Doug.Ostien
New APLGrid 6.0 Features
Posted: Thursday, April 20, 2006 11:48 AM (EST)

The improvements look very good, but no mention is made of one that I hope is included.  The problem of missing values (empty cells) is bugging me right now, particularly empty numeric cells.  There was a discussion thread last year in July started by Nicolai Ohm that aired the problem, but no real solution was offered that didn't involve jumping through a lot of hoops. (Please read that discussion as background to this.)  It seems to me that the grid should seamlessly handle empty numeric cells, properly reading them as such when saving the contents and then putting them back as empty when reloading the grid.

 

Does the new version of the grid accomplish this or at least provide an easy way to handle the problem?

 

Thanks, Doug

     

Patrick.Parks
New APLGrid 6.0 Features
Posted: Thursday, April 20, 2006 2:35 PM (EST)

Hi Doug,
 

I'm sorry that I missed out on that discussion thread but you'll have to fill me in if you don't mind.  Give me a better idea of what you are trying to solve.

 
I am going to guess that the problem is you have numeric values that are that have some "distinguished" value (such as ¯4294967297 perhaps) and you would like to be able to put those into the grid and have the cell appear blank.  Then when you read them back out of the grid you want to get that original input value back again.  Is that something like what you have in mind?

 

We don't have an "xMissing" value defined for such a purpose and that is probably what you were hoping to have.

 

One way you could have handled this in the past would be to load the grid by setting the xValue property with a mixture of numeric values and empty strings.  Then after loading those strings you can set the xValueType to 1 for all the cells.  They will then be loaded with numbers but some of them will be blank.  And when you reference them they will return the xConversionErrorValue which by default has the value of .¯4294967297.

 

But there are several other approaches you might want to think about (or at least learn about for solving other issues).  Some of the new grid features may offer you a little hope… just not as convenient as you  might have preferred.  There are a couple ways to handle this problem.  The important thing to note is that you no longer have to unload the whole grid… you can now easily detect which cells have changed (xChanges) and unload only those cell values using scatter-point indexing.  So the only problem you face is loading the grid so that your missing cells get painted as blank unless the user enters values into them (assuming they are not protected).


There are two ways to accomplish the issue of making your missing cells appear blank.  Perhaps easiest is to virtualize the grid by setting the xVirtualMode and xVirtualParts properties to dynamically load the body of the grid "on demand".  This will speed up initial loading since only the cells that are visible will be loaded at first.  If you have your data in a numeric matrix in WS then you should be able to satisfy the onVirtualLoad event requests for data very easily and quickly.  The grid is that when your see your missing value in your data values, simply avoid loading that cell.  The missing cells will appear blank and when it comes time to unload they data those cells will not be in the xChanges list unless the user has edited them.  I'd suggest that you set the data type of all such cells to numeric either explicitly via the xCellType property on a per-cell basis or BETTER if the whole column (whole row or whole grid) is numeric you can cell the default cell type to numeric by setting the xCellType on the column (0 C) or or row (R 0) or grid (0 0).


The other approach load the whole grid of numeric data at once by setting a rectangular block of xNumber cells and then go back and selectively clear the missing cells to blank by using the XDeleteCells method with scatter-point indexing to "clear".  Here's and example:


      Œwi 'xNumber' (¼5) (¼10) ((10×¼5)°.+¼10)
      mv"'#' Œwi 'missing'
      Œwi 'DeleteCells' (3 2½1 1 3 7 2 2) mv
      Œwi 'xText' (¼5) (¼10)
    12 13 14 15 16 17 18 19 20
 21    23 24 25 26 27 28 29 30
 31 32 33 34 35 36    38 39 40
 41 42 43 44 45 46 47 48 49 50
 51 52 53 54 55 56 57 58 59 60
      Œwi 'xConversionErrorValue' ¯2147352572
      Œwi 'xNumber' (¼5) (¼10)
 ¯2147352572          12 13 14 15 16          17 18 19 20
          21 ¯2147352572 23 24 25 26          27 28 29 30
          31          32 33 34 35 36 ¯2147352572 38 39 40
          41          42 43 44 45 46          47 48 49 50
          51          52 53 54 55 56          57 58 59 60


Later, after the user has edited the grid and changed some cells and it is time to save, you can determine what has changed and then reference those value like this:


      changes"Œwi 'xChanges'
      changes
 2 3
 3 1
 4 2
      Œwi 'xNumber' changes mv
777 999 888


If you are editing that form then you are done.  But if this is just a save and continue editing then you will probably want to clear the changed flags which is done like this:


      Œwi 'xChanges' Ð


Pat

     

Patrick.Parks
New APLGrid 6.0 Features
Posted: Thursday, April 20, 2006 2:40 PM (EST)

Correction.  I said the default xConversionError was ¯4294967297 but in fact it is ¯2147352572.  Sorry about that!

 

 

     

Michael.Shumate
New APLGrid 6.0 Features
Posted: Friday, April 21, 2006 5:43 PM (EST)

The hoops you just described jumping through are why we need the results he's asking for.

 

I second his request. If you put xConversionError in a cell, it should look blank!

 

Just adding my vote.

 

/mas

     



APL2000 Official Web Site

Make others happy and joyful. Your happiness will multiply a thousand fold.
--- Swami Sivananda

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