Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

undocumented feature: TableView

119 views
Skip to first unread message

Guido Tripaldi

unread,
Oct 8, 2009, 7:49:15 AM10/8/09
to
Hello,

today I typed by accident "TableView" instead of "TableForm" writing a
notebook, so I discovered a function apparently not documented in
Mathematica 7 / Mac version. "TableView" displays a list in a
spreadsheet-like format. I tried to search the DocumentationCenter
without finding any information, neither Google nor Wolfram search
engine gave better results. The only documentation I found was using
the "Information - (??)" command. It show the options that TableView
accepts.

It appears to be very useful, as it introduces a more flexible way to
observing the data. There are infact some data editing features
accessible through a popup menu (a "+" icon on the top left of the
view) and others ctrl-clicking the view (ctrl-click on Mac; right-
click on Windows).

Perhaps it is a new feature being finalized that will be included in
next version. Someone maybe knows something more about this function?


In[1]:= mylist = Table[ Subscript[a, i, j], {i, 5}, {j, 3} ]
(* a little matrix *)

In[2]:= mylist // TableView (* show it as a small spreadsheet
*)

In[3]:= ?? TableView
System`TableView
Attributes[TableView] = {Protected, ReadProtected}

Options[TableView] := {Background -> None, BaseStyle -> {},
DefaultBaseStyle -> "TableView", DefaultLabelStyle ->
"TableViewLabel",
FrameStyle -> GrayLevel[0.85], ContentSize -> Automatic,
ItemSize -> 10,
LabelStyle -> {}, RotateLabel -> False, Spacings -> Automatic,
TableHeadings -> {Automatic, Automatic}}


Guido


Colin Rose

unread,
Oct 9, 2009, 7:17:04 AM10/9/09
to
In article <hakjjr$d4v$1...@smc.vnet.net>,
Guido Tripaldi <gu...@gtripaldi.it> wrote:

> Hello,
>
> today I typed by accident "TableView" instead of "TableForm" writing a

> In[1]:= mylist = Table[ Subscript[a, i, j], {i, 5}, {j, 3} ]

> (* a little matrix *)
>
> In[2]:= mylist // TableView (* show it as a small spreadsheet
> *)


How cool.

David Reiss

unread,
Oct 9, 2009, 7:23:32 AM10/9/09
to
Clearly a function in the midst of the development process and
probably not quite ready for prime time. It may vanish or be renamed
in afuture version ...


In[3]:= Unprotect[TableView]

Out[3]= {"TableView"}

In[4]:= ?? TableView

System`TableView

Attributes[TableView]={ReadProtected}

Options[TableView]:={Background->None,BaseStyle->{},DefaultBaseStyle-
>TableView,DefaultLabelStyle->TableViewLabel,FrameStyle->GrayLevel
[0.85],ContentSize->Automatic,ItemSize->10,LabelStyle->{},RotateLabel-
>False,Spacings->Automatic,TableHeadings->{Automatic,Automatic}}

In[5]:= ClearAttributes[TableView, ReadProtected]

In[10]:= ?? TableView

System`TableView

BoxForm`OptionsCache[TableView]^:={Background->None,BaseStyle->
{},DefaultBaseStyle->TableView,DefaultLabelStyle-
>TableViewLabel,FrameStyle->GrayLevel[0.85],ContentSize-
>Automatic,ItemSize->10,LabelStyle->{},RotateLabel->False,Spacings-
>Automatic,TableHeadings->{Automatic,Automatic}}

MakeBoxes[BoxForm`a_TableView,BoxForm`fmt_]^:=BoxForm`MakeRowBoxes
[BoxForm`a,BoxForm`fmt]/;Refresh[BoxForm`UseTextFormattingQ,None]

MakeBoxes[TableView[],BoxForm`fmt_]^:=With[{TableView`m=ConstantArray
[Null,{10,4}]},MakeBoxes[TableView[TableView`m],BoxForm`fmt]]

MakeBoxes[TableView[TableView`dims:{_Integer,_Integer}],BoxForm`fmt_]
^:=With[{TableView`m=ConstantArray[Null,TableView`dims]},MakeBoxes
[TableView[TableView`m],BoxForm`fmt]]

MakeBoxes[TableView[TableView`data_List,BoxForm`opts___],BoxForm`fmt_]
^:=With[{TableView`boxid=TableView`boxidValue
[BoxForm`opts],TableView`headings=TableView`headingsValue
[BoxForm`opts],TableView`showtypes=TableView`showTypesValue
[BoxForm`opts],TableView`resizeable=TableView`resizeableQ
[BoxForm`opts],TableView`size=ContentSize/.Flatten
[{BoxForm`opts,Options[TableView]}]},((((TagBox
[#1,TableView`TableViewTag[BoxForm`opts],BoxID-
>TableView`boxid,DefaultBaseStyle->TableView]&)[ToBoxes
[#1,BoxForm`fmt]]&)[Deploy[EventHandler[#1,
{{MenuCommand,NewRow}:>TableView`NewRowColumnEvent
[TableView`boxid,ButtonNotebook[],row],
{MenuCommand,NewColumn}:>TableView`NewRowColumnEvent
[TableView`boxid,ButtonNotebook[],column],
{MenuCommand,Copy}:>TableView`CopyEvent[TableView`boxid,ButtonNotebook
[]]}]]]&)[Panel[Pane[#1,Sequence@@FilterRules[{BoxForm`opts},Options
[Pane]],ImageSize->TableView`size,ImageSizeAction-
>Scrollable,Scrollbars->If[TableView`resizeable,Automatic,False]]]]&)
[Grid[TableView`addHeadings[Map
[RawBoxes,TableView`dataToTableViewGridBoxContent
[TableView`data,TableView`showtypes],
{2}],TableView`boxid,TableView`headings,BoxForm`opts],Sequence@@FilterRules
[{BoxForm`opts},Options[Grid]],ItemSize->{10,1.2},Background-
>White,Frame->All,FrameStyle->LightGray,Alignment->Left,DefaultElement-
>TemplateBox[{\[Placeholder]},TableViewItem],DefaultBaseStyle->
{TableViewGrid,Deployed->False}]]]/;FreeQ[PadRight[Dimensions
[Unevaluated[TableView`data]],2,0],0]

Options[TableView]:={Background->None,BaseStyle->{},DefaultBaseStyle-
>TableView,DefaultLabelStyle->TableViewLabel,FrameStyle->GrayLevel
[0.85],ContentSize->Automatic,ItemSize->10,LabelStyle->{},RotateLabel-
>False,Spacings->Automatic,TableHeadings->{Automatic,Automatic}}

On Oct 8, 7:49 am, Guido Tripaldi <gu...@gtripaldi.it> wrote:
> Hello,
>

> today I typed by accident "TableView" instead of "TableForm" writing a =



> notebook, so I discovered a function apparently not documented in
> Mathematica 7 / Mac version. "TableView" displays a list in a
> spreadsheet-like format. I tried to search the DocumentationCenter
> without finding any information, neither Google nor Wolfram search
> engine gave better results. The only documentation I found was using

> the "Information - (??)" command. It show the options that TableView =



> accepts.
>
> It appears to be very useful, as it introduces a more flexible way to
> observing the data. There are infact some data editing features
> accessible through a popup menu (a "+" icon on the top left of the
> view) and others ctrl-clicking the view (ctrl-click on Mac; right-
> click on Windows).
>
> Perhaps it is a new feature being finalized that will be included in
> next version. Someone maybe knows something more about this function?
>

> In[1]:= mylist = Table[ Subscript[a, i, j], {i, 5}, {j, 3} ] =



> (* a little matrix *)
>

> In[2]:= mylist // TableView (* show it as a small spread=


sheet
> *)
>
> In[3]:= ?? TableView
> System`TableView
> Attributes[TableView] = {Protected, ReadProtected}
>
> Options[TableView] := {Background -> None, BaseStyle -> {},
> DefaultBaseStyle -> "TableView", DefaultLabelStyle ->
> "TableViewLabel",

> FrameStyle -> GrayLevel[0.85], ContentSize -> Automatic, =

> ItemSize -> 10,
> LabelStyle -> {}, RotateLabel -> False, Spacings -> Automa=

David Reiss

unread,
Oct 9, 2009, 7:24:16 AM10/9/09
to
By the way, it is pretty easy to drill down in something like this to
fine new undocumented functions in interesting Contexts by using the
trick in my previous post as well as simple things like

Names["TableView `*"]

It seems like TableView is in a somewhat advanced state of
development. And one could use it to create a pretty sophisticated
spreadsheet application with multiple sheets and so on. With a parser
for Excel functions one could import Excel sheets with their
associated functionality... (now, do I have time to do this? No,
but...)

Here is an example of TableView's use for multiple sheets...


TabView[{40 ->
TableView[40 IdentityMatrix[40], ContentSize -> {400, 300}],
20 -> TableView[20 IdentityMatrix[20], ContentSize -> {400, 300}],
10 -> TableView[10 IdentityMatrix[10], ContentSize -> {400, 300}]}]

Oct 8, 7:49 am, Guido Tripaldi <gu...@gtripaldi.it> wrote:

> Hello,
>
> today I typed by accident "TableView" instead of "TableForm" writing a =



> notebook, so I discovered a function apparently not documented in
> Mathematica 7 / Mac version. "TableView" displays a list in a
> spreadsheet-like format. I tried to search the DocumentationCenter
> without finding any information, neither Google nor Wolfram search
> engine gave better results. The only documentation I found was using

> the "Information - (??)" command. It show the options that TableView =



> accepts.
>
> It appears to be very useful, as it introduces a more flexible way to
> observing the data. There are infact some data editing features
> accessible through a popup menu (a "+" icon on the top left of the
> view) and others ctrl-clicking the view (ctrl-click on Mac; right-
> click on Windows).
>
> Perhaps it is a new feature being finalized that will be included in
> next version. Someone maybe knows something more about this function?
>

> In[1]:= mylist = Table[ Subscript[a, i, j], {i, 5}, {j, 3} ] =



> (* a little matrix *)
>

> In[2]:= mylist // TableView (* show it as a small spread=


sheet
> *)
>
> In[3]:= ?? TableView
> System`TableView
> Attributes[TableView] = {Protected, ReadProtected}
>
> Options[TableView] := {Background -> None, BaseStyle -> {},
> DefaultBaseStyle -> "TableView", DefaultLabelStyle ->
> "TableViewLabel",

> FrameStyle -> GrayLevel[0.85], ContentSize -> Automatic, =

> ItemSize -> 10,
> LabelStyle -> {}, RotateLabel -> False, Spacings -> Automa=

Murray Eisenberg

unread,
Oct 10, 2009, 7:15:09 AM10/10/09
to
TableView does allow a nice display of tabular data. And right-clicking
rows or columns provides useful possibilities.

Perhaps a more interesting question is how the display functionality
might be extended (unless already there!) so that one can retrieve the
table currently displayed in the TableView output. Of course it's
unclear how this could/should be done: the result of TableView is
already the table you see

Right now, of course, one can use the menu item Insert > Table/Matrix to
input tabular data, but I've always found using that a bit clunky:
unless you start in the top left placeholder and carefully tab from each
placeholder to the next, it's too easy to find the cursor outside any
placeholder.

With TableView, it's really easy to just click anywhere within one of
the spreadsheet-like cells and type, delete, etc.

Moreover, if the added functionality were there, then TableView would be
a really nice way to gather tabular input interactively, with minimal
programming compared with what would now be required.

Right now, one can almost get the functionality with TableView that I'd
like, but it's awkward. For example, suppose first you evaluate:

TableView[Table[0, {3}, {2}]]

Then you go ahead and change some of the entries so that you see in the
display, e.g.:

2 -5
hello 1+1
2/3 Plot[x^2,{x,0,1}]

The new values are not yet assigned to anything. But the changed table
is a result -- still in an output cell -- and the content of an output
cell can be used as input:

data = List@@First[%];
data // InputForm
{{2, "-5"}, {"hello", "1+1"}, {"2/3", "2+3I"}}
ToExpression[data] (* evaluates the cell contents *)

Perhaps there's some way, using Dynamic, that one does not need to do
things as I've just shown, so that TableView could in fact be used for
interactive data input, under program control.

Let's hope that WRI brings TableView into more public view and enhances
it in future releases.

David Reiss wrote:
> By the way, it is pretty easy to drill down in something like this to
> fine new undocumented functions in interesting Contexts by using the
> trick in my previous post as well as simple things like
>
> Names["TableView `*"]
>
> It seems like TableView is in a somewhat advanced state of
> development. And one could use it to create a pretty sophisticated
> spreadsheet application with multiple sheets and so on. With a parser
> for Excel functions one could import Excel sheets with their
> associated functionality... (now, do I have time to do this? No,
> but...)
>
> Here is an example of TableView's use for multiple sheets...
>
>
> TabView[{40 ->
> TableView[40 IdentityMatrix[40], ContentSize -> {400, 300}],
> 20 -> TableView[20 IdentityMatrix[20], ContentSize -> {400, 300}],
> 10 -> TableView[10 IdentityMatrix[10], ContentSize -> {400, 300}]}]
>
>
>
>
>
> Oct 8, 7:49 am, Guido Tripaldi <gu...@gtripaldi.it> wrote:

>> Hello,
>>
>> today I typed by accident "TableView" instead of "TableForm" writing a =


>
>> notebook, so I discovered a function apparently not documented in
>> Mathematica 7 / Mac version. "TableView" displays a list in a
>> spreadsheet-like format. I tried to search the DocumentationCenter
>> without finding any information, neither Google nor Wolfram search
>> engine gave better results. The only documentation I found was using

>> the "Information - (??)" command. It show the options that TableView =


>
>> accepts.
>>
>> It appears to be very useful, as it introduces a more flexible way to
>> observing the data. There are infact some data editing features
>> accessible through a popup menu (a "+" icon on the top left of the
>> view) and others ctrl-clicking the view (ctrl-click on Mac; right-
>> click on Windows).
>>
>> Perhaps it is a new feature being finalized that will be included in
>> next version. Someone maybe knows something more about this function?
>>

>> In[1]:= mylist = Table[ Subscript[a, i, j], {i, 5}, {j, 3} ] =


>
>> (* a little matrix *)
>>

>> In[2]:= mylist // TableView (* show it as a small spread=


> sheet
>> *)
>>
>> In[3]:= ?? TableView
>> System`TableView
>> Attributes[TableView] = {Protected, ReadProtected}
>>
>> Options[TableView] := {Background -> None, BaseStyle -> {},
>> DefaultBaseStyle -> "TableView", DefaultLabelStyle ->
>> "TableViewLabel",

>> FrameStyle -> GrayLevel[0.85], ContentSize -> Automatic, =
>
>> ItemSize -> 10,
>> LabelStyle -> {}, RotateLabel -> False, Spacings -> Automa=


> tic,
>> TableHeadings -> {Automatic, Automatic}}
>>
>> Guido
>
>

--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

Guido Tripaldi

unread,
Oct 12, 2009, 6:37:54 AM10/12/09
to

@David


> In[5]:= ClearAttributes[TableView, ReadProtected]
> In[10]:= ?? TableView
>

> it is pretty easy to drill down [..] by using the trick in my
previous post

nice trick, I learned something new today, thankyou David!

@Murray


> Perhaps there's some way, using Dynamic, that one does not need to do
> things as I've just shown, so that TableView could in fact be used
for
> interactive data input, under program control.

Unfortunately, Dynamic[edited = TableView[data]] doesn't allow any
editing, trying to modify the cells makes M7 beep: "You tried to edit
inside a subexpression that cannot be edited, because it is a fixed
special form". I've tried Dynamic[TableView[data], Temporary] and
SetOptions[Dynamic, Editable -> True] but doesn't work.

It would be easy and useful to use interactively the edited data.

> Let's hope that WRI brings TableView into more public view and
enhances
> it in future releases.

definitely!

Guido


Il giorno 10/ott/09, alle ore 13:08, Murray Eisenberg ha scritto:

>>> Hello,
>>>
>>> today I typed by accident "TableView" instead of "TableForm"

>>> writing a =


>>
>>> notebook, so I discovered a function apparently not documented in
>>> Mathematica 7 / Mac version. "TableView" displays a list in a
>>> spreadsheet-like format. I tried to search the DocumentationCenter
>>> without finding any information, neither Google nor Wolfram search
>>> engine gave better results. The only documentation I found was using
>>> the "Information - (??)" command. It show the options that

>>> TableView =


>>
>>> accepts.
>>>
>>> It appears to be very useful, as it introduces a more flexible way
>>> to
>>> observing the data. There are infact some data editing features
>>> accessible through a popup menu (a "+" icon on the top left of the
>>> view) and others ctrl-clicking the view (ctrl-click on Mac; right-
>>> click on Windows).
>>>
>>> Perhaps it is a new feature being finalized that will be included in
>>> next version. Someone maybe knows something more about this
>>> function?
>>>

>>> In[1]:= mylist = Table[ Subscript[a, i, j], {i, 5}, {j, 3} ] =


>>
>>> (* a little matrix *)
>>>

>>> In[2]:= mylist // TableView (* show it as a small spread=
>> sheet


>>> *)
>>>
>>> In[3]:= ?? TableView
>>> System`TableView
>>> Attributes[TableView] = {Protected, ReadProtected}
>>>
>>> Options[TableView] := {Background -> None, BaseStyle -> {},
>>> DefaultBaseStyle -> "TableView", DefaultLabelStyle ->
>>> "TableViewLabel",

>>> FrameStyle -> GrayLevel[0.85], ContentSize -> Automatic, =
>>
>>> ItemSize -> 10,
>>> LabelStyle -> {}, RotateLabel -> False, Spacings -> Automa=


>> tic,
>>> TableHeadings -> {Automatic, Automatic}}
>>>
>>> Guido
>>
>>
>

> --
> Murray Eisenberg mur...@math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower phone 413 549-1020 (H)
> University of Massachusetts 413 545-2859 (W)
> 710 North Pleasant Street fax 413 545-1801
> Amherst, MA 01003-9305
>

---
Guido Tripaldi
imho.gtripaldi.it


Ariel SepĂșlveda

unread,
Oct 12, 2009, 6:45:38 AM10/12/09
to
I use SpreadsheetViewMXL for viewing and editing tabular data
(http://www.prontoanalytics.com/products/mxlplus/documentation.htm). With
SpreadsheetViewMXL you can dynamically resize the window size, edit values,
assign data (complete dataset or only data in window) to a variable and
export to different formats. You can also sort by one or more columns, find
values and do some other useful things like printing data and freezing
columns, inserting/deleting rows or columns etc. The documentation for
OutputViewMXL shows that SpreadsheetViewMXL can also be used with nested
data.

Right now TableView is very limited in its ability to display large
datasets. I tested with 10,000 rows in TableView and it couldn't handle it.
SpreadsheetViewMXL can manage much larger datasets. This seems to be based
on the need of TableView to create an image for the complete dataset and
then use Pane to display only part of that big image. On the other hand,
SpreadsheetViewMXL only creates an image of the data in the dynamically
defined window dimensions. If my assumptions are right the design of
TableView will make it more suitable for small datasets.

It seems like there will be space for the effective co-existence of both
solutions.


-----Original Message-----
From: Murray Eisenberg [mailto:mur...@math.umass.edu]
Sent: Saturday, October 10, 2009 7:08 AM
Subject: Re: undocumented feature: TableView

TableView does allow a nice display of tabular data. And right-clicking
rows or columns provides useful possibilities.

Perhaps a more interesting question is how the display functionality
might be extended (unless already there!) so that one can retrieve the
table currently displayed in the TableView output. Of course it's
unclear how this could/should be done: the result of TableView is
already the table you see

Right now, of course, one can use the menu item Insert > Table/Matrix to

John Fultz

unread,
Oct 12, 2009, 6:46:21 AM10/12/09
to
Yes, this is an experimental feature. A few comments...

On Sat, 10 Oct 2009 07:08:10 -0400 (EDT), Murray Eisenberg wrote:
> TableView does allow a nice display of tabular data. And right-clicking
> rows or columns provides useful possibilities.
>
> Perhaps a more interesting question is how the display functionality
> might be extended (unless already there!) so that one can retrieve the
> table currently displayed in the TableView output. Of course it's
> unclear how this could/should be done: the result of TableView is
> already the table you see

If you mean retrieve it by evaluation, you could just wrap First[] around the
view. The FullForm of TableView[matrix] is TableView[matrix]. What you see
on-screen is formatting, not evaluation. I think you figured this out below,
but I wanted to state it clearly for anyone who didn't follow all the way
through.


> Right now, of course, one can use the menu item Insert > Table/Matrix to
> input tabular data, but I've always found using that a bit clunky:
> unless you start in the top left placeholder and carefully tab from each
> placeholder to the next, it's too easy to find the cursor outside any
> placeholder.
>
> With TableView, it's really easy to just click anywhere within one of
> the spreadsheet-like cells and type, delete, etc.
>
> Moreover, if the added functionality were there, then TableView would be
> a really nice way to gather tabular input interactively, with minimal
> programming compared with what would now be required.

Yes, the potential is obvious. The present version of TableView doesn't support
Dynamic, though. That, along with certain other shortcomings in integration, is
one of the major reasons it's undocumented and experimental. And it may yet see
some redesign before we're comfortable documenting it.


> Right now, one can almost get the functionality with TableView that I'd
> like, but it's awkward. For example, suppose first you evaluate:
>
> TableView[Table[0, {3}, {2}]]
>
> Then you go ahead and change some of the entries so that you see in the
> display, e.g.:
>
> 2 -5
> hello 1+1
> 2/3 Plot[x^2,{x,0,1}]
>
> The new values are not yet assigned to anything. But the changed table
> is a result -- still in an output cell -- and the content of an output
> cell can be used as input:
>
> data = List@@First[%];
> data // InputForm
> {{2, "-5"}, {"hello", "1+1"}, {"2/3", "2+3I"}}
> ToExpression[data] (* evaluates the cell contents *)
>
> Perhaps there's some way, using Dynamic, that one does not need to do
> things as I've just shown, so that TableView could in fact be used for
> interactive data input, under program control.
>
> Let's hope that WRI brings TableView into more public view and enhances
> it in future releases.

TableView, such as it is, should have a pretty solid and robust implementation.
As always, we certainly appreciate the comments on this forum. They do make a
difference.

Sincerely,

John Fultz
jfu...@wolfram.com
User Interface Group
Wolfram Research, Inc.

0 new messages