Re: Widget placement problem [message #51460] |
Fri, 24 November 2006 20:58 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Braedley writes:
> For some reason, I had to set the TV keyword in order to get rid of
> those lines.
I suppose there could be a rounding error with some image
sizes, when you ask to keep the aspect ratio and you are
trying to put it into a window that is exactly the right
size. In this case a TV keyword without the KEEP_ASPECT
is probably the correct command anyway.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Widget placement problem [message #51461 is a reply to message #51460] |
Fri, 24 November 2006 19:54  |
Braedley
Messages: 57 Registered: September 2006
|
Member |
|
|
David Fanning wrote:
> Braedley writes:
>
>> I want to put a small logo in a draw widget at the bottom left hand
>> corner of a tab. The only other thing in the tab is a series of
>> labels. Right now, the draw widget is being placed just below the
>> text, and not at the very bottom of the tab like I would like. Summery
>> of code:
>>
>> read_jpeg, 'logo.jpg', logo
>>
>> base=widget_base(title='Wizard', /col)
>>
>> tab_steps=widget_tab(base)
>> intro=widget_base(tab_steps, title='Introduction', row=2, xsize=600,
>> ysize=400)
>> text_base=widget_base(intro, /base_align_left, col=1)
>> t1='This wizard will help you set up stuff.'
>> l1=widget_label(text_base, value=t1)
>> ;there's more labels, but who cares
>>
>> sz=size(logo)
>> draw_base=widget_base(intro, /align_left, /base_align_bottom)
>> logo_win=widget_draw(draw_base, xsize=sz[2], ysize=sz[3],
>> /align_bottom)
>>
>> widget_control, base, /realize
>> widget_control, logo_win, get_value=win
>> wset, win
>> tvimage, logo, /keep_aspect_ratio
>>
>> I've tried various combinations of alignments, but nothing seems to
>> work. Any suggestions?
>
> The main problem you are having is that you cannot position
> widgets in bulletin board bases in the way you are doing it
> (I.e., by setting ALIGN_*** keywords). You have to position
> them via OFFSETS from the upper-left hand corner of the base
> you are positioning them into. For example, I can get this
> logo hear the bottom of the base just by estimating the offsets.
> (If I want to get it *exactly* there, I have to get the geometry
> of the base and subtract the size of the image from that.)
>
> base=widget_base(title='Wizard', /col)
>
> tab_steps=widget_tab(base)
> intro=widget_base(tab_steps, title='Introduction', row=2, $
> xsize=600,ysize=400)
> text_base=widget_base(intro, /base_align_left, col=1)
> t1='This wizard will help you set up stuff.'
> l1=widget_label(text_base, value=t1)
> ;there's more labels, but who cares
>
> sz=size(logo)
> draw_base=widget_base(intro, /align_left, /base_align_bottom)
> logo_win=widget_draw(draw_base, xsize=sz[2], $
> ysize=sz[3],xoffset=0, yoffset=375-sz[3])
>
> widget_control, base, /realize
> widget_control, logo_win, get_value=win
> wset, win
> tvimage, logo, /keep_aspect_ratio
>
>
>> While I'm on it, I'm getting black lines around the bottom and left of
>> the image that aren't present in the original. Is this a tvimage thing
>> or something else?
>
> I don't see any black lines. I doubt if it is a TVImage thing. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks for the tip.
For some reason, I had to set the TV keyword in order to get rid of
those lines.
|
|
|
Re: Widget placement problem [message #51463 is a reply to message #51461] |
Fri, 24 November 2006 13:26  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Braedley writes:
> I want to put a small logo in a draw widget at the bottom left hand
> corner of a tab. The only other thing in the tab is a series of
> labels. Right now, the draw widget is being placed just below the
> text, and not at the very bottom of the tab like I would like. Summery
> of code:
>
> read_jpeg, 'logo.jpg', logo
>
> base=widget_base(title='Wizard', /col)
>
> tab_steps=widget_tab(base)
> intro=widget_base(tab_steps, title='Introduction', row=2, xsize=600,
> ysize=400)
> text_base=widget_base(intro, /base_align_left, col=1)
> t1='This wizard will help you set up stuff.'
> l1=widget_label(text_base, value=t1)
> ;there's more labels, but who cares
>
> sz=size(logo)
> draw_base=widget_base(intro, /align_left, /base_align_bottom)
> logo_win=widget_draw(draw_base, xsize=sz[2], ysize=sz[3],
> /align_bottom)
>
> widget_control, base, /realize
> widget_control, logo_win, get_value=win
> wset, win
> tvimage, logo, /keep_aspect_ratio
>
> I've tried various combinations of alignments, but nothing seems to
> work. Any suggestions?
The main problem you are having is that you cannot position
widgets in bulletin board bases in the way you are doing it
(I.e., by setting ALIGN_*** keywords). You have to position
them via OFFSETS from the upper-left hand corner of the base
you are positioning them into. For example, I can get this
logo hear the bottom of the base just by estimating the offsets.
(If I want to get it *exactly* there, I have to get the geometry
of the base and subtract the size of the image from that.)
base=widget_base(title='Wizard', /col)
tab_steps=widget_tab(base)
intro=widget_base(tab_steps, title='Introduction', row=2, $
xsize=600,ysize=400)
text_base=widget_base(intro, /base_align_left, col=1)
t1='This wizard will help you set up stuff.'
l1=widget_label(text_base, value=t1)
;there's more labels, but who cares
sz=size(logo)
draw_base=widget_base(intro, /align_left, /base_align_bottom)
logo_win=widget_draw(draw_base, xsize=sz[2], $
ysize=sz[3],xoffset=0, yoffset=375-sz[3])
widget_control, base, /realize
widget_control, logo_win, get_value=win
wset, win
tvimage, logo, /keep_aspect_ratio
> While I'm on it, I'm getting black lines around the bottom and left of
> the image that aren't present in the original. Is this a tvimage thing
> or something else?
I don't see any black lines. I doubt if it is a TVImage thing. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|