OpenerView, multiple sub cells and Notebook1Write...
- To: mathgroup at smc.vnet.net
- Subject: [mg104197] OpenerView, multiple sub cells and Notebook1Write...
- From: Jason Ledbetter <jasonbrent at gmail.com>
- Date: Thu, 22 Oct 2009 22:34:36 -0400 (EDT)
Folk, Sorry for yet-another-UI-programming question.... (Perhaps I should start trying to use wolfram's support for these types of things?) My ultimate goal here is an interactive report that will be played with Player Pro (and potentially webMathematica in the future). From a document design perspective, I was thinking about having my sections split using the OpenerView widget with content embedded under the (layered) opener widgets. I'm having two problems and I'm not sure if they are bugs, lack of capability or lack of understanding on my part. 1 - In a normal notebook, I'm attempting to create an OpenerView with multiple-cells as the second argument. I'm able to generate sample multi-cell content WITHOUT OpenerView using the following: NotebookWrite[InputNotebook[], CellGroupData[ { Cell["test", "Subtitle"], ToBoxes@ListPlot[Table[i, {i, 1, 5}]] } ] ] However, when I try to embed this WITH OpenerView, the "header" gets printed but the CellGroupData comes out as uninterpreted text: OpenerView[{"header", CellGroupData[ { Cell["test", "Subtitle"], ToBoxes@ListPlot[Table[i, {i, 1, 5}]] } ]}] Q: How can multi-cell output be embedded in OpenerView and properly interpreted? 2 - When OpenerView is sent to a document via NotebookWrite, the header portion acts different than in a normal notebook. OpenerView[{"Text Label", a + b + c}] This generates an opener with 'a+b+c' as the content and 'Text Label' (no printed quotes) as the header. NotebookWrite[InputNotebook[], ToBoxes@OpenerView[{"Text Label", a + b + c}]] This generates an opener with 'a+b+c' as the content and "Text Label" (WITH printed quotes) as the header. I looks like when using NotebookWrite, the Cell that embeds all of this is set to "Input" instead of "Output" (from show expression) Q: How can I get this to be an output cell? A: looks like I might have my answer for this one: NotebookWrite[InputNotebook[], Cell[BoxData[ToBoxes@OpenerView[{"Text Label", a + b + c}]], "Output"]] Any other suggestions on how to approach this would be appreciated however. TIA, -jbl