Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: GUIKit and VisibleRect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52564] Re: [mg52549] GUIKit and VisibleRect
  • From: Jeff Adams <jeffa at wolfram.com>
  • Date: Thu, 2 Dec 2004 02:21:16 -0500 (EST)
  • References: <200412011058.FAA20039@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Dec 1, 2004, at 4:58 AM, Peter Dickof wrote:

> The following draws a little plot and shows the associated visible
> rectangle:
>
> ref = GUIRun[
>       Widget["Frame",
>         {Widget["ImageLabel",
>             {"data" -> Script[ExportString[
>                     Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi},
>                       DisplayFunction -> Identity],
>                      "GIF",
>                     ImageSize -> 300,
>                     ConversionOptions -> {"Transparency" ->
> GrayLevel[1]}]]
>               }, Name -> "myImageLabel"]}, Name -> "myFrame"]];
> (ref@PropertyValue[{"myImageLabel", "VisibleRect"}])@toString[]
> (ref@PropertyValue[{"myImageLabel", "Bounds"}])@toString[]
>
> The following resizes the frame and puts a bigger image into it. The
> visible rectangle is not updated. It is also not writable.
>
> ref @ Script[
>     newData = ExportString[
>          Plot3D[Sin[2x y], {x, 0, Pi}, {y, 0, Pi},
>           DisplayFunction -> Identity],
>         "GIF",
>         ImageSize -> 500,
>         ConversionOptions -> {"Transparency" -> GrayLevel[1]}];
>     SetPropertyValue[{"myImageLabel", "data"}, newData];
>     SetPropertyValue[{"myFrame", "Size"}, Widget["Dimension",
>         {"width" -> 600, "height" -> 500}]];
>     ]
> (ref@PropertyValue[{"myImageLabel", "VisibleRect"}])@toString[]
> (ref@PropertyValue[{"myImageLabel", "Bounds"}])@toString[]
>
> A mouse resize will fix this. How do I do that with a program?
>
> Thanks for your help.
>
> Peter Dickof

Hello Peter,

After calling:

SetPropertyValue[{"myFrame", "Size"},
   Widget["Dimension", {"width" -> 600, "height" -> 500}]];

try adding

InvokeMethod[{"myFrame", "Validate"}];

which will programmatically recompute the new sizes of the frame and all
its children, including the image label's new display and size based on
its new image data.

Thanks
Jeff Adams
Wolfram Research



  • Prev by Date: Re: Compile ReplacePart
  • Next by Date: Re: Re: Finding the Fourier transform of discrete functions
  • Previous by thread: GUIKit and VisibleRect
  • Next by thread: ReplacePart position