Printing a collection of widget items [message #49502] |
Tue, 01 August 2006 13:19  |
Ryan.
Messages: 77 Registered: March 2006
|
Member |
|
|
Dear All,
I have one window with a collection of button, text, draw and label
widgets (in one base widget) and would like to know if there is a way
of printing it. I tried to get the value (id) of the base widget to
try to use David Fanning's TVREAD routine, but you cannot call the
get_value parameter on a widget_base. Has anyone been able to do this
or does anyone know what the correct way to do it? My routine is quite
lengthy because there are so many widgets so I will not include it but
I can put it up if you would like. Thanks.
Ryan.
|
|
|
|
Re: Printing a collection of widget items [message #49560 is a reply to message #49502] |
Thu, 03 August 2006 07:27   |
mmiller3
Messages: 81 Registered: January 2002
|
Member |
|
|
>>>> > "Ryan" == Ryan <rchughes@brutus.uwaterloo.ca> writes:
> Thanks for your response but all my draw widgets are
> indicator lights (only 1 of 5 colors) for about 30
> different things so putting the labels on manually would
> not be feasible. It would be better for me to spend my
> time writing something where all the indicators are written
> directly to a postscript file. I am using IDL on UNIX and
> have the plotting set to X windows. Thanks for the
> suggestion though.
Ryan,
Here's a procedure that uses import (from ImageMagick) to capture
a top level base. It helps to know the title of the base widget
as well as the widget id - then it is entirely automatic.
Otherwise you'll need to select the window with the mouse. (does
anyone know how to get the title of a base widget in IDL?)
Note that the type of file that you are capturing to is
determined by the extension of the filename: .ps for postscript,
.pdf for pdf, .jpg for jpeg, and so on.
Hope this helps, Mike
pro import_tlb, widget_id, filename, title=title
;; Bring the widget to the front:
widget_control, widget_id, iconify=0
;; If we know the window title, then capture it directly, otherwise
;; use what the user selects:
if n_elements(title) eq 1 then begin
cmnd = 'import -screen -window "' + title + '" ' + filename
endif else begin
cmnd = 'import -screen ' + filename
endelse
spawn, cmnd, result
print, result
end
--
Michael A. Miller mmiller3@iupui.edu
Imaging Sciences, Department of Radiology, IU School of Medicine
|
|
|
Re: Printing a collection of widget items [message #49631 is a reply to message #49559] |
Fri, 04 August 2006 10:15  |
Mike[2]
Messages: 99 Registered: December 2005
|
Member |
|
|
Benjamin Hornberger wrote:
> What happens if the title is not unique? Will it capture the window in
> the foreground?
I think it will capture the foremost window. If you've selected
another window with the same title, I think you'll get that one.
> It looks like import works only for X Windows. But I found out that
> Irfanview can also run in command-line mode to do the same on MS Windows.
That's good to know!
Mike
|
|
|