Re: Plot resize [message #31158] |
Fri, 07 June 2002 11:22 |
crono15m
Messages: 9 Registered: June 2002
|
Junior Member |
|
|
crono15m@aol.com (Ben) wrote in message news:<fbb3dcd9.0206070607.68492c9c@posting.google.com>...
> I have a fairly complex widget program that has dynamically resizing
> parts.
>
> Why is it that Event.X and Event.Y return values smaller than the
> actual form (base) size.
>
> Not that you would need to but I should be able to set the form size
> to Event.X and Event.Y
>
> When I do this the form shrinks. On my system it shrinks by 8 pixels
> in x and and 46 in Y. This is different on other systems (maybe due to
> resolution etc.)
>
> Anyone know what causes this and how to stop it?
>
> Thanks,
> Ben Hilldore
> Hope College Nuclear Research Group
Thanks to Dave I now have a solution to this. I used the known gap
between my plot widget and my base to calculate what the offset should
be and then get a fudge factor from that.
Thanks,
Ben Hilldore
|
|
|
Re: Plot resize [message #31160 is a reply to message #31158] |
Fri, 07 June 2002 10:37  |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Ben wrote:
> I have a fairly complex widget program that has dynamically resizing
> parts.
>
> Why is it that Event.X and Event.Y return values smaller than the
> actual form (base) size.
>
> Not that you would need to but I should be able to set the form size
> to Event.X and Event.Y
>
> When I do this the form shrinks. On my system it shrinks by 8 pixels
> in x and and 46 in Y. This is different on other systems (maybe due to
> resolution etc.)
>
> Anyone know what causes this and how to stop it?
Here's a snippet from the top level base event handler for the IMGUI
demo procedure described in my book:
http://www.gumley.com/PIP/About_Book.html
It shows how to resize a draw widget (and hence a top level base)
following a top level base resize event:
;- Get change in size of top level base
if (info.version lt 5.4) then begin
xchange = event.x - info.base_size[0]
ychange = event.y - info.base_size[1]
endif else begin
widget_control, event.id, tlb_get_size=base_size
xchange = base_size[0] - info.base_size[0]
ychange = base_size[1] - info.base_size[1]
endelse
;- Set new size of draw widget
info.draw_xsize = (info.draw_xsize + xchange) > 200
info.draw_ysize = (info.draw_ysize + ychange) > 200
widget_control, info.draw_id, xsize=info.draw_xsize,
ysize=info.draw_ysize
;- Store new top level base size
widget_control, event.top, tlb_get_size=base_size
info.base_size = base_size
info.version is the IDL version number
info.base_size is the last known top level base size [width, height]
info.draw_xsize is the last known draw widget width
info.draw_ysize is the last known draw widget height
info.draw_id is the id of the draw widget
The version dependent code is required because prior to IDL 5.4, the top
level base size obtained by calling widget_control with the tlb_get_size
keyword did not include the size of the menu bar. To put the example in
context, you may wish to examine the complete IMGUI source code at the
URL shown above (see "Sample Programs").
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
|
|
|