7
$\begingroup$

I make different controls(InputFields,Text,panel, etc) in my code for which the corresponding code is below.

  inputFieldValue = 10;
  (*Markers*)
  markers = Row[{
                Column[{
                MouseAppearance[
                               Style["\[FilledUpTriangle]", Bold, Black, {15,15},ShowStringCharacters -> False],
                                "LinkHand"
                                ],
                MouseAppearance[
                                Style["\[FilledDownTriangle]", Bold, Black, {15, 15}, ShowStringCharacters -> False],
                                "LinkHand"
                              ]
                       },
                      Spacings -> 0,
                      Alignment -> Center,
                      Background -> RGBColor[0.65, 0.65, 0.65]
                     ](*Column is CLosed*)
                },
               BaselinePosition -> Axis
              ];
   (*InputField*)
   field = Dynamic[Row[{InputField[
                            Dynamic[inputFieldValue],
                            Number,
                            ContinuousAction -> True,
                            ImageSize -> {50, 20},
                            Alignment -> Center
                                 ]
                        },
                        BaselinePosition -> Axis
                      ]
                   ];

I want to find exact ImageSizes of the controls for accurate placement in another grid. I am listing the options that I have with me here.

case1:

     Rasterize[markers][[2, 2]]

case2:

    Rasterize[field][[2, 2]]

and also,I arrange this controls in different formats.like,

arrange1:

 userField = Row[{
            markers,
            field
            },
        Frame -> False
        ]

arrange2:

     panelRow = 
            Panel[Row[{userField, userField, userField, userField, userField, 
                  userField, userField, userField, userField, userField
                     }], 
                  FrameMargins -> -3, Appearance -> "Frameless"
                 ]

case3:

 Rasterize[userField][[2, 2]]

case4:

Rasterize[panelRow][[2, 2]]

if you evaluate case1,the ImageSize is ({9,23}) which is wrong as I have already mentioned size of markers is {15,15}.

Based on the options provided here, I did try to use the Rasterize function with no success. My idea is to figure out the Imagesize and span them across a layout whose pixel or unit value is 10. Also, if I have an image of an odd dimension, for example, like `ImageSize -> {67, 38}, I want to set my values for the control object to next closest higher multiple of span value, which in the case of my example is {70, 40} so that my control object will not suffer due to insufficient spaces.

Yet another option that I did try was to use Options[markers] which also does not give me the value of the size of the control objects. Right now, I am putting my control objects into Pane with scroll bars to accommodate for different sizes of the control objects without compromising the size or display of the control objects.

$\endgroup$
1
  • 2
    $\begingroup$ There's also Rasterize[a, "RasterSize"] if that helps. $\endgroup$
    – Szabolcs
    Commented Feb 28, 2013 at 17:53

1 Answer 1

1
$\begingroup$

I don't really know what you're trying to do here, but here's a simple observation on one of the things you're doing:

g = Rasterize[
  Style["\[FilledUpTriangle]", Bold, Black, {15, 15}, 
    ShowStringCharacters -> False]]

triangle

The [15,15} appears to be (mostly) ignored, because the resulting graphic is {9,16}.

$\endgroup$
2
  • $\begingroup$ ok fine,then How can we estimate the exact size of control objedts? $\endgroup$
    – subbu
    Commented Jan 30, 2013 at 5:29
  • 1
    $\begingroup$ The {15,15} is in the wrong place: g = Rasterize[ Style["[FilledUpTriangle]", Bold, Black, ShowStringCharacters -> False], RasterSize -> {15, 15}] creates a {15,15} image as Szabolcs suggested. $\endgroup$
    – bill s
    Commented Mar 30, 2013 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.