nisus.com
https://www.nisus.com/forum/

Table Selection
https://www.nisus.com/forum/viewtopic.php?f=17&t=3362
Page 1 of 1

Author:  phspaelti [ 2009-03-20 07:40:29 ]
Post subject:  Table Selection

The macro reference says the following:

Quote:
TableSelection.new tableObject, [rowRangeObject], [columnRangeObject] v1.1
Returns a new selection describing a cell region within the given table. Both Range objects must be in-bounds for the table or an error will be displayed. If either range is not provided then the selection will encompass all rows/columns.[emphasis mine]


When I try something like this
Code:
$myTableSel = TableSelection.new $myTable, $rowRange

it works as expected and I get full rows selected. But any attempt to not provide the row range fails. For example the following just returns an error:
Code:
$myTableSel = TableSelection.new $myTable, , $columnRange

So my question is: is it possible to provide only a column range with some syntax I don't know about? Or is the manual in error? Or is this a bug?

Author:  martin [ 2009-03-20 13:03:49 ]
Post subject:  Re: Table Selection

The core issue is that the macro language's support for missing arguments is limited. One can only omit arguments from the tail of the of list, not in the middle as you've attempted.

As to the wording in the macro language, it merely refers to the first two of the following valid usages:
Code:
$myTableSel = TableSelection.new $myTable
$myTableSel = TableSelection.new $myTable, $rowRange
$myTableSel = TableSelection.new $myTable, $rowRange, $colRange


It would be more clear but less succinct to say, "if the row range, or both the row and column range, is not provided then..." Do you think the verbosity is needed to make the behavior clear?

Author:  Kino [ 2009-03-21 03:32:16 ]
Post subject:  Re: Table Selection

martin wrote:
One can only omit arguments from the tail of the of list, not in the middle as you've attempted.
In that case, I think something like this would be clearer (to me at least: I seldom read the description ;-)
Code:
TableSelection.new tableObject[, rowRangeObject[, columnRangeObject]]

Author:  phspaelti [ 2009-03-25 07:54:40 ]
Post subject:  Re: Table Selection

Thanks Martin, Kino, for the comments. I deduced that this was the behavior, but now I have peace of mind as well!

As far as the description goes, since it is a technical reference I think precision trumps verbosity, but if you're worried about verbosity you could drop the either making it:
Quote:
If ranges are not provided then…

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/