comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » GET_DRAW_VIEW question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
GET_DRAW_VIEW question [message #16132] Fri, 02 July 1999 00:00 Go to next message
Daniel Peduzzi is currently offline  Daniel Peduzzi
Messages: 29
Registered: June 1999
Junior Member
I'm interested in retrieving the viewport position for a scrolling
draw widget via the GET_DRAW_VIEW keyword to WIDGET_CONTROL.
This seems to work well for the case when the viewport size equals
the size of the draw widget (in which case, I don't need the widget
to be scrollable.) But for all other cases when the viewport size
is smaller than the actual widget size, I get the same non-zero offset
of 19 (on an Ultrabook.)

The code below illustrates what I'm seeing. Since GET_DRAW_VIEW
returns the "X and Y position relative to the lower left corner of
the graphics area", I'm converting the Y value so that it is relative
to the top of the draw widget. (I also enabled button events so I had a
way to invoke the "scroll event" procedure for the window with no scroll bars.)


pro scroll_event, event
widget_control, event.id, get_draw_view=view
g = widget_info(event.id,/geometry)
view[1] = g.draw_ysize - view[1] - g.ysize
print,view
end

device, true_color=24, decomposed=0

x = 300
scroll_x = 300
y = 200
scroll_y = 200

; Create a draw widget where the viewport size equals the actual size
drawbase1 = widget_base(title='Viewport = Size')
drawwin1 = widget_draw(drawbase1, /viewport_events, xsize=x, ysize=y, $
x_scroll_size=scroll_x, y_scroll_size=scroll_y, $
event_pro='scroll_event', /button_events)

; Now create a draw widget where the viewport size is LESS than the actual size
scroll_y = 100
drawbase2 = widget_base(title='Viewport < Size')
drawwin2 = widget_draw(drawbase2, /viewport_events, xsize=x, ysize=y, $
x_scroll_size=scroll_x, y_scroll_size=scroll_y, $
event_pro='scroll_event', /button_events)

widget_control, drawbase1, /realize
widget_control, drawbase2, /realize

xmanager, 'window_1', drawbase1, /no_block
xmanager, 'window_2', drawbase2, /no_block

end



Clicking in the first window yields a viewport position of (0,0) as expected.
However, moving the scroll bar of the second window to its topmost position
consistently yields a (0, 19).

Does anyone know why this is the case? Should I simply compensate for this
offset by subtracting 19 from the y position? I'm concerned that this value
may be different on other systems.

Any help is appreciated!


Dan Peduzzi
peduzzi@mediaone.net
Re: GET_DRAW_VIEW question [message #16226 is a reply to message #16132] Mon, 05 July 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Daniel Peduzzi (peduzzi@mediaone.net) writes:

> I'm interested in retrieving the viewport position for a scrolling
> draw widget via the GET_DRAW_VIEW keyword to WIDGET_CONTROL.
> This seems to work well for the case when the viewport size equals
> the size of the draw widget (in which case, I don't need the widget
> to be scrollable.) But for all other cases when the viewport size
> is smaller than the actual widget size, I get the same non-zero offset
> of 19 (on an Ultrabook.)
>
> Does anyone know why this is the case? Should I simply compensate for this
> offset by subtracting 19 from the y position? I'm concerned that this value
> may be different on other systems.

Well, it is definitely different on different machines.
I get an offset of 13 on my Windows NT machine. But I don't
really understand why. Could you please let us know if you
find out?

Thanks,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Classes and Widget Event Handlers...
Next Topic: Saving structure variables

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:53 PDT 2025

Total time taken to generate the page: 0.00599 seconds