What is the best way to right align a button in a dialog window, regardless of the window's WindowSize
?
Here is a resizable window to test on:
CreateDialog[
Column[{"Here's some text text text text text text text",
ChoiceButtons[]}],
WindowFrameElements -> {"ResizeArea"},
WindowFrame -> "Normal"]
I would like the button to always be right aligned.
Some unsatisfactory solutions I thought of:
Put the button in an
Item
and right align. Then the right margin is determined by theColumn
size which can't easily be set in pixels.Put the button in a
Panel
, right align it, and set a fixed size on the panel. Again, the size is determined by the panel size, not the window size.
Use case:
Suppose we need to create an alternative to MessageDialog
. This new function, myMessageDialog
, should take the WindowSize
option, and the created notebook should respond to SetOptions[nb, WindowSize -> ...]
The dialog buttons should always be aligned to the right edge of the window regardless of the window size.
Item
. Could you useSpacer
to set a margin after converting pixels to printer's points? $\endgroup$Item
sizes can only be set in ems, not pixels. I use theItem
approach in the image uploader's history dialog, and on a Chinese version of Windows, the sizes are all messed up because of the unpredictability of the em width (different system font). $\endgroup$Spacer
uses pixels. An em is the width of the letter M, or something like that ... $\endgroup$Spacer
works as desired you can use that to set the margin, can you not? That's one problem down if so. $\endgroup$