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
- References:
- GUIKit and VisibleRect
- From: pdickof@scf.sk.ca (Peter Dickof)
- GUIKit and VisibleRect