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

Home » Public Forums » archive » Re: border around 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: border around draw widget [message #50369 is a reply to message #50364] Wed, 27 September 2006 11:06 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Wed, 27 Sep 2006 15:42:43 +0200, Laurens wrote:

> Hi,
>
> I have a couple of draw widgets displaying various gamma-scans. Now the
> user has to select two of them by clicking on them; done.
> But now I want to let the user know where he clicked, so is it possible
> to draw some sort of red border of a few pix around the clicked
> draw-widget? I know they have a frame property, but that's just too thin
> and doesn't attract attention...

You could make the frame thicker. Something like:

IDL> b=widget_base(/ROW)
IDL> t=widget_draw(b,xsize=200,ysize=200,FRAME=10)
IDL> b2=widget_base(b,xsize=200,ysize=200,xpad=10,ypad=10,/COLUMN )
IDL> t2=widget_draw(b2,xsize=200,ysize=200)
IDL> widget_control, b,/realize

Unfortunately with this setup, you'll have to kill and re-create
everything whenever the user selects a new draw widget (since FRAME's
are only possible when the widget is created). Not ideal. You'll
probably want to use UPDATE=0/1 to avoid flickering.

Here's a trick that avoids all that killing/recreating. Use a
bulletin board base (no /ROW or /COLUMN), and then layer two bases
inside it: one which holds your draw widget, offset by 10 pixels in x an
y, and one empty base which has FRAME=10 set, whose only purpose in life
is to display that frame. Simply map and unmap the empty draw base to
add/remove the frame as necessary. Something like:

IDL> b=widget_base()
IDL> b1=widget_base(b,xsize=200,ysize=200,xpad=10,ypad=10)
IDL> t=widget_draw(b1,xsize=200,ysize=200)
IDL> b2=widget_base(b,xsize=200,ysize=200,FRAME=10)
IDL> widget_control, b,/realize
IDL> widget_control, b2,map=0 ; remove frame
IDL> widget_control, b2,map=1 & widget_control, b1,map=1 ; add frame back

To make it easier, wrap this functionality up in a compound
"frame-toggle-draw" widget of some sort, and then layout as many of
these as you need. I might instead make it an object widget for
additional convenience (so I can pass it an image to draw, tell it to
erase, etc.), but a regular compound widget would work as well. Then
something like:

widget_control,frame_toggle_draw_widget_id,SET_VALUE=0 ; turn frame off

could be enough to "de-select" that draw.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: call_procedure with a dynamically created arguments list?
Next Topic: Listing of Internal IDL Routines

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

Current Time: Fri Oct 10 23:19:59 PDT 2025

Total time taken to generate the page: 0.88559 seconds