Re: Slide_Image (widget_draw) Scollbar-Position ? [message #7027] |
Fri, 13 September 1996 00:00 |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
On Thu, 12 Sep 1996, Ulrich Steinbrecher wrote:
<cut>
> I need the Position of the scrollbars, or the upper_left, lower_right
> Coordinates of the scroll_image.
> I found the "WIDGET_EVENT with a TYPE :3" means Viewport Moved, but the
> Region of the Viewport is not returned
> And i want to position the scollbars from an event, i.e.
> horizontal_start, vertical_start.
Check out the DRAW_VIEWPORT_EVENTS, GET_DRAW_VIEW and SET_DRAW_VIEW keywords
in the online help for WIDGET_CONTROL. (Also VIEWPORT_EVENTS in WIDGET_DRAW.)
You should be able to accomplish what you want with these. In brief:
. Create the draw widget with dwid=WIDGET_DRAW(/VIEWPORT_EVENTS,...), or
alternatively, zap it with WIDGET_CONTROL,dwid,/DRAW_VIEWPORT_EVENTS once
it has been created. Then your event handler will receive events when the
user fiddles with a viewport slider. As you've seen, you can distinguish
such events from cursor movement and mouse click events by the TYPE field
in the event variable which is passed to your event handler.
e.g., IF (event.TYPE EQ 3) THEN (handle the viewport event).
. You can get the viewport position from:
WIDGET_CONTROL,dwid,GET_DRAW_VIEW=viewxy (where dwid is the widget ID of
your draw widget). The bottom left position is [0,0].
Normally you'd do this on receiving a viewport event, but you can do it
anytime.
. If you want to set the viewport of a draw widget (e.g., to sync it with
another of the same size), use:
WIDGET_CONTROL,dwid,SET_DRAW_VIEW=newviewxy
where "newviewxy" is a 2-element integer array giving the new bottom-left
position for the viewport.
Peter Mason
|
|
|