# Tag Info

5

UPDATE As Kuba correctly notes in the comment, with negative CellMargins we can make the cell height to be effectively zero: CellPrint@Cell[BoxData["a"], CellElementSpacings -> {"CellMinHeight" -> 0, "ClosedCellHeight" -> 0}, Background -> Hue[.8], CellMargins -> -2, CellOpen -> False, CellFrame -> 0, ShowCellBracket -> ...

2

This gives the recently opened files as a list of rules: Lookup[Options@$FrontEnd, NotebooksMenu] Just the file names: First /@ Lookup[Options@$FrontEnd, NotebooksMenu] FileNameJoin instead of FrontEndFileName: (only tested on windows) FileNameJoin[(Append @@ ((First@Last[#])[[;; 2]]))[[2 ;;]]] & /@ Lookup[Options@$FrontEnd, NotebooksMenu] 3 The .NB files with implementations of the FrontEnd export options Dialogs are located in the folder FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "SystemResources"}] For example, the "PDF Options" Dialog is in the file "ExportPDF.nb". You can open it with a text editor and inspect the implementation. From the internals of the ...

1

Here is another solution in the spirit of the answer by M.R. (should work starting from Mathematica version 7): AbsoluteImageDimensions[img_Image] := Module[{m = CurrentValue[Magnification], w0, h0, w}, {w0, h0} = ImageDimensions[img]; w = Options[img, ImageSize][[1, 2, 1]]; {m {w, w*h0/w0}, 100 (m w/w0)^2}] And here is a better version ...

1

Using Alexey's pattern: AbsoluteImageDimensions[img_] := Module[{m = CurrentValue[Magnification]}, Cases[{ToBoxes@img}, GraphicsBox[___, OrderlessPatternSequence[ Verbatim[Rule][ImageSizeRaw, {w0_, h0_}], Verbatim[Rule][PlotRange, _], Verbatim[Rule][ImageSize, {w_, _}]]] :> {m {w, w*h0/w0}, 100 (m w/w0)^2}, ...

2

Here is one approach (Mathematica version 10 is required). Paste the following code as the next cell after the cell with your image and evaluate: cell = NotebookRead[PreviousCell[]]; m = CurrentValue[Magnification] Cases[cell, GraphicsBox[__, OrderlessPatternSequence[ImageSize -> {w_, _}, ___, ImageSizeRaw -> {w0_, h0_}], ___] :> {m {w, ...

4

There is a straightforward way to set CellMargins to be zero: DialogInput[ DialogNotebook[{ExpressionCell[Pane[RandomImage[], ImageMargins -> 8], CellMargins -> 0]}]] Instead of ImageMargins we can rely on CellFrameMargins: DialogInput[ DialogNotebook[{ExpressionCell[RandomImage[], CellMargins -> 0, CellFrameMargins -> 8, ...

2

As noted by ilian, this behaviour is explained in StoringAndTrackingPaletteStates tutorial. Shortly, CurrentValue[\$FrontEnd, SystemPalettesMenuSettings] keeps those values cached. In order to achieve what I described in the question we have to drop an entry that coresponds to our palette. It doesn't really matter when it's done. Just do it before you ...

3

I gave up looking for neat solution. Here's brute force. Since the bottom CellMargins are not respected then let's not use any! :) We can use Pane and its ImageMargins to take control over padding. DialogInput[ DynamicModule[{}, Pane[RandomImage[], ImageMargins -> 8], Initialization :> (SetOptions[EvaluationCell[], CellMargins -> ...

8

This syntax was deprecated in the version 6.0 era. According to the legacy documentation, For example, in version 5.2, the following strings are interpreted differently string1 = "first line second line" string2 = "\<first line second line\>"

2

It really expects that you have some buttons along the bottom. DialogInput[Column[{Pane @ RandomImage[], Button["OK", DialogReturn[0]]}]] but you can do it this way DialogInput[Column[{Pane @ RandomImage[], ""}]] Update I Think it looks better with the bottom margin a bit larger than the top, but if you are being picky about equal margins, try ...

4

Set the ClosingSaveDialog option in the created notebook: nb = CreateDocument[TextCell[ExampleData[{"Text", "LoremIpsum"}], "Text"]]; SetOptions[nb, ClosingSaveDialog -> True]

2

This is a Linux-specific bug that has been fixed in Mathematica 10.0.2 and later.

2

You can't run Kernel Blocking Dialogs on the preemptive link. But you can prompt other dialogs. And we can abuse that to run a procedure containing Input[], DialogInput[] or some system dialogs. The trick is to run your code inside an asynchronous initialization of the regular dialog: MessageDialog[ DynamicModule[{}, 1, Initialization :> ...

0

I think there is no general/stable way to prompt kernel blocking dialog from another kernel blocking dialog. answerPrompt[] := Input["Give me the answer please."]; confirmationPrompt[] := ChoiceDialog["Are you sure?"]; You don't need to do that though. Use the code below in your Do loop to answer and confirm questions: While[ answer = answerPrompt[]; ...

Top 50 recent answers are included