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

Home » Public Forums » archive » DRAW Widget
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Draw Widget [message #36787 is a reply to message #6438] Mon, 27 October 2003 13:37 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Valerio Pace" wrote...
> Dear all,
>
> I'm starting to learn IDL (5.5) and I'd like to create a GUI with the
> IDLGUIBuilder, in which I can use "compound" draw widget.
> In particular, when I use the scroll bar of one of them I'd like that this
> action produce the same effects on the others.
> Have you any idea or suggestion?

My suggestion would be to not use the GUI builder. I don't think that it
help you learn IDL and it will most likely just get in the way.

Get comfortable with the documentation. Specifically WIDGET_DRAW, the
APP_SCROLL keyword, and "Scrolling Draw Widgets" section under "Using Draw
Widgets". Also of interest will be the SET_DRAW_VIEW keyword to
WIDGET_CONTROL.

Here is an example from the documentation modified to work in a manner
similar to what you are trying to do. This is a crude example, but it
should get you started.

-Rick



; Event-handler routine.
PRO draw_scroll_event, ev
WIDGET_CONTROL, ev.top, GET_UVALUE=info

IF (ev.TYPE EQ 3) THEN BEGIN
; Update window 1
WIDGET_CONTROL, info.draw1, SET_DRAW_VIEW=[ev.X, ev.Y]
WSET, info.drawID1
TVSCL, info.image, 0-ev.X, 0-ev.Y

; Update window 2
WIDGET_CONTROL, info.draw2, SET_DRAW_VIEW=[ev.X, ev.Y]
WSET, info.drawID2
TVSCL, info.image, 0-ev.X, 0-ev.Y
endif


END

; Widget creation routine.
PRO draw_scroll

; Read an image for use in the example.
READ_JPEG, FILEPATH('muscle.jpg', $
SUBDIR=['examples', 'data']), image

; Create the base widget.
base1 = WIDGET_BASE(TITLE='Main')

; Create the draw widget. The size of the viewport is set to
; 200x200 pixels, but the size of the drawable area is
; set equal to the dimensions of the image array using the
; XSIZE and YSIZE keywords.
draw1 = WIDGET_DRAW(base1, X_SCROLL_SIZE=200, Y_SCROLL_SIZE=200, $
XSIZE=(SIZE(image))[1], YSIZE=(SIZE(image))[2], /APP_SCROLL)

; Create a second base widget.
base2 = WIDGET_BASE(TITLE='Secondary')

; Create a second draw widget.
draw2 = WIDGET_DRAW(base2, X_SCROLL_SIZE=200, Y_SCROLL_SIZE=200, $
XSIZE=(SIZE(image))[1], YSIZE=(SIZE(image))[2], /APP_SCROLL)

; Realize the widgets.
WIDGET_CONTROL, base1, /REALIZE
WIDGET_CONTROL, base2, /REALIZE

; Retrieve the window ID from the draw widget.
WIDGET_CONTROL, draw1, GET_VALUE=drawID1
WIDGET_CONTROL, draw2, GET_VALUE=drawID2

; Set the first draw widget as the current drawable area and draw.
WSET, drawID1
TVSCL, image

; Set the second draw widget as the current drawable area and draw.
WSET, drawID2
TVSCL, image

info = {image:image, $
draw1:draw1, $
drawID1:drawID1, $
drawID2:drawID2, $
draw2:draw2}

WIDGET_CONTROL, base1, SET_UVALUE=info

; Call XMANAGER to manage the widgets.
XMANAGER, 'draw_scroll', base1, /NO_BLOCK


END
[Message index]
 
Read Message
Read Message
Previous Topic: Delete COMMON
Next Topic: compound widget like dialog_pickfile ?

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

Current Time: Sat Oct 11 14:03:53 PDT 2025

Total time taken to generate the page: 0.72358 seconds