Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
2  
There's also Rasterize[a, "RasterSize"] if that helps. –  Szabolcs Feb 28 '13 at 17:53
add comment

1 Answer

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}.

share|improve this answer
    
ok fine,then How can we estimate the exact size of control objedts? –  subbu Jan 30 '13 at 5:29
1  
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. –  bill s Mar 30 '13 at 14:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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