extent of unwrapped text in a button
- To: mathgroup at smc.vnet.net
- Subject: [mg103101] extent of unwrapped text in a button
- From: divisor <congruentialuminaire at yahoo.com>
- Date: Tue, 8 Sep 2009 05:56:59 -0400 (EDT)
Hello MathGroup: I am using the code below which I absconded from David Reiss's paper about Mathematica V6 (http://scientificarts.com/worklife/notebooks/ MIERArticleReiss.nb). I want the palette to have a dynamic width and height based on the extent of the text in the buttons and the number of buttons. Depending on the number of notebooks open, the palette displays some wicked word- wrapping! :-) I tried to check the options after the buttons were created (w/o the ImageSize option), but the only options that are displayed are the supplied settings (i.e. Allignment-> & Appearance-> ). TIA. Regards.. Roger Williams Franklin Laboratory -------------------------------------- currentlyOpenNotebooks[] := Module[{allNotebooks = Notebooks[], names, buttons , pageWidth = 130, pageHeight = 500 , notebookData}, names = CurrentValue[#, "NotebookFileName"] & /@ allNotebooks; notebookData = Sort@Transpose[{names, allNotebooks}]; buttons = Column[ Button[Style[#[[1]], 10, Bold, Darker@Blue], SetSelectedNotebook[#[[2]]], Appearance -> "Palette", Alignment -> Left, ImageSize -> {pageWidth, All}] & /@ notebookData]; CreateWindow@PaletteNotebook[buttons (*,CellMargins->{{0,0},{0,0}} *) , WindowTitle -> "Current Notebooks", PageWidth -> pageWidth, WindowSize -> {All, pageHeight}, WindowElements -> "VerticalScrollBar"] ];