MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: closing notebook cells

  • To: mathgroup at
  • Subject: [mg51847] Re: [mg51798] Re: [mg51762] closing notebook cells
  • From: John Fultz <jfultz at>
  • Date: Wed, 3 Nov 2004 01:25:43 -0500 (EST)
  • Reply-to: jfultz at
  • Sender: owner-wri-mathgroup at

I've already said most of what you need to know.  The output is largely 
self-explanatory.  It takes a notebook argument and returns a list of for each cell in the selection (only one if you've only 
selected a single cell or the content of a cell).  Each list contains rules 
with various bits of information about the thing that's selected (similar 
to the way NotebookInformation[] works).  The rules currently returned 

"Style" - the cell's style
"ContentData" - the type of cell (e.g. GraphicsData, BoxData, TextData)
"Evaluating" - boolean, whether the cell is in the evaluation queue
"Rendering" - boolean, whether the cell is in the rendering queue
"NeedsRendering" - boolean, whether the cell would need to be rendered if
"CursorPosition" - the position of the cursor, could be "CellBracket" or
   a list of numbers representing the content selection
"FirstCellInGroup" - boolean, is the cell a head cell of a group
"CellSerialNumber" - unique numerical ID for the cell
"Formatted" - boolean, whether the cell or the cell expression is being
"InlineCellPosition" - if selection is in inline cell, then the cell's
   position relative to the topmost cell

Of course, since this is part of the undocumented packet interface, we 
reserve the right to make changes to it.  I hope to see this or something 
like it promoted to a documented function similar to NotebookInformation[] 
in the future.


John Fultz
jfultz at
User Interface Group
Wolfram Research, Inc.

On Tue, 2 Nov 2004 21:39:25 +0100, Ingolf Dahl wrote:
> CellInformation[] - that sounds wonderful. But I have searched in help,
> the
> Wolfram site and Google, and also entered
> ??CellInformation, and I do not find any information anywhere! Please
> inform, how do I use it?
> Ingolf Dahl
> Sweden
>> -----Original Message-----
>> From: John Fultz [mailto:jfultz at]
To: mathgroup at
>> Sent: Tuesday, November 02, 2004 08:06
>> To: mathgroup at
>> Subject: [mg51847] [mg51798] Re: [mg51762] closing notebook cells
>> On Mon, 1 Nov 2004 02:52:43 -0500 (EST), Barthelet, Luc wrote:
>>> As I learned in mathgroup a few years ago I am using the following
>>> code
>>> to close automatically my graphics groups.
>>> CloseAnim[]:=(SelectionMove[EvaluationNotebook[],All,GeneratedCell];
>>> FrontEndTokenExecute["OpenCloseGroup"];);
>>> CloseAnim::usage = "CloseAnim[]";
>>> For example:
>>> Table[Show[Graphics[
>>> {Hue[Random[] ],Rectangle[{0,0},{1,1}]
>>> }]],{3}];
>>> CloseAnim[];
>>> The problem is that when I only generate a single cell
>>> "OpenCloseGroup"
>>> will generate a beep.
>>> Any idea on how to prevent that beep or test if GeneratedCell
>>> selected a
>>> single or several cells?
>>> Thanks
>>> Luc
>> LinkWrite[$ParentLink, CellInformation[EvaluationNotebook[]]];
>> Length[LinkRead[$ParentLink]]
>> If the length is greater than 1, then you can use the OpenCloseGroup
>> token.
>> CellInformation[] is new to version 5 and is, in general, a very good
>> way
>> to test various properties of the selection without having to do a
>> NotebookRead[] (which could get very expensive if you have a selection
>> which consumes a lot of memory).
>> Sincerely,
>> John Fultz
>> jfultz at
>> User Interface Group
>> Wolfram Research, Inc.

  • Prev by Date: Re: Re: bimodal ditribution form counting signs of Pi digits differences
  • Next by Date: Re: Garbage collection problem
  • Previous by thread: Re: Re: Re: closing notebook cells
  • Next by thread: Re: 3D plotting problem