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

Home » Public Forums » archive » rescaling draw widgets: is there an easier solution to this?
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
rescaling draw widgets: is there an easier solution to this? [message #89563] Mon, 27 October 2014 08:23 Go to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
I would like to have a widget_draw (or widget_window) within a widget_base with stuff on the top, left, right and bottom of the draw widget. If I change the size of the base with the mouse, I would like the draw widget to expand accordingly.

I found a way to do this, by keeping track of the size of the widgets (base and draw). However, I'm wondering if there is a cleaner way to do this.

Here is an example code:

pro testWidgetRescale_event, event
widget_control, event.top, get_uvalue=struct
newBaseGeometry = widget_info((*struct).wb, /geometry)
baseDiff = [newBaseGeometry.xsize-(*struct).baseGeometry.xsize, newBaseGeometry.ysize-(*struct).baseGeometry.ysize]
widget_control, (*struct).wd, xsize = (*struct).drawGeometry.xsize+baseDiff[0], ysize = (*struct).drawGeometry.ysize+baseDiff[1]
(*struct).drawGeometry = widget_info((*struct).wd, /geometry)
(*struct).BaseGeometry = newBaseGeometry
end

pro testWidgetRescale
wb = widget_base(/tlb_size_events, /tlb_move_events, column=3, /BASE_ALIGN_CENTER, /ALIGN_CENTER)
void = widget_label(wb, value=' some stuff here', /align_center)
row2 = widget_base(wb, /column)
void = widget_label(row2, value=' some stuff here')
wd = widget_draw(row2, xsize=500,ysize=500)
void = widget_label(row2, value=' some stuff here')
void = widget_label(wb, value=' some stuff here', /align_center)
widget_control, wb, /realize
baseGeometry = widget_info(wb, /geometry)
drawGeometry = widget_info(wd, /geometry)
widget_control, wb, set_uvalue=ptr_new({wb:wb, wd:wd, baseGeometry:baseGeometry, drawGeometry:drawGeometry})
xmanager, 'testWidgetRescale', wb, event_handler = 'testWidgetRescale_event' , /no_block
end


thanks,
Helder
Re: rescaling draw widgets: is there an easier solution to this? [message #89564 is a reply to message #89563] Mon, 27 October 2014 08:30 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Helder writes:

> I found a way to do this, by keeping track of the size of the widgets (base and draw). However, I'm wondering if there is a cleaner way to do this.

That's how I do it. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: rescaling draw widgets: is there an easier solution to this? [message #89565 is a reply to message #89564] Mon, 27 October 2014 08:36 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, October 27, 2014 4:30:54 PM UTC+1, David Fanning wrote:
> Helder writes:
>
>> I found a way to do this, by keeping track of the size of the widgets (base and draw). However, I'm wondering if there is a cleaner way to do this.
>
> That's how I do it. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

thanks David. I was hoping in some hidden "dynamic_resize_magic" keyword...

Cheers,
Helder
Re: rescaling draw widgets: is there an easier solution to this? [message #89566 is a reply to message #89565] Mon, 27 October 2014 08:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Helder writes:

> thanks David. I was hoping in some hidden "dynamic_resize_magic" keyword...

Scheduled for 2035, I think. :-)

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: rescaling draw widgets: is there an easier solution to this? [message #89570 is a reply to message #89565] Mon, 27 October 2014 09:57 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Monday, October 27, 2014 11:36:40 AM UTC-4, Helder wrote:

> thanks David. I was hoping in some hidden "dynamic_resize_magic" keyword...
>

Automatic resizing would be my number 2 request for a new widget system.
Number 1 would be the ability to easily add color to widget buttons, so as to upgrade from the 1980's look.

--Wayne
Re: rescaling draw widgets: is there an easier solution to this? [message #89571 is a reply to message #89570] Mon, 27 October 2014 10:25 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Monday, October 27, 2014 5:57:49 PM UTC+1, wlandsman wrote:

> Number 1 would be the ability to easily add color to widget buttons, so as to upgrade from the 1980's look.

I am working on style sheets for widgets in FL. Here is an example:

pro test
base=widget_base(xs=200, ys=100)
text=widget_text(base, value="Hello world!", xoff=50, yoff=30, xs=100, ys=50, $
style_sheet="background-color: green; color: yellow")
widget_control, /realize, base
xmanager
end

It produces this widget: http://fl.t15.org/hello.png

But is is far from complete :-(

regards,
Lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL Way to have a single row/collum act on all rows/collums in an array
Next Topic: Islands disappear with cgmap_GSHHS and GSHHS 2.3.0

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

Current Time: Wed Oct 08 11:43:04 PDT 2025

Total time taken to generate the page: 0.00816 seconds