Obtaining the Size of a Remote Display
QUESTION: I know how to obtain the screen size of my current graphics device with the Get_Screen_Size keyword to the Device command, but how can I reliably get the screen size of a remote display?
ANSWER: The Get_Screen_Size function has a Display_Name keyword that will allow you to obtain the screen size of remote displays. This keyword is only available on X window devices.
Note that in IDL 5.1 through IDL 5.3 (at least) this function does not work as advertised. This is because the code has a programming error in which the Display_Name keyword is attached to the draw widget creation routine, instead of to the base widget creation routine where it belongs. Here is what the correct code should look like. You will have to modify your code to make it work correctly. The program file can be found in the IDL lib sub-directory.
FUNCTION get_screen_size, display_arg, DISPLAY_NAME=display_name, $ RESOLUTION = resolution ; Set default display name. IF (N_ELEMENTS(display_arg) EQ 0) THEN BEGIN IF (N_ELEMENTS(display_name) EQ 0) THEN $ inDisplayName = "" $ ELSE $ inDisplayName = display_name ENDIF ELSE $ inDisplayName = display_arg ; Programming error here. These lines should be changed. ;wBase = WIDGET_BASE(MAP=0) ;wDraw = WIDGET_DRAW(wBase, XSIZE=10, YSIZE=10, GRAPHICS_LEVEL=2, $ ; DISPLAY_NAME=inDisplayName) ; Correct code here. wBase = WIDGET_BASE(MAP=0,DISPLAY_NAME=inDisplayName) wDraw = WIDGET_DRAW(wBase, XSIZE=10, YSIZE=10, GRAPHICS_LEVEL=2) ; Create a small pixmap on the given display. WIDGET_CONTROL, wBase, /REALIZE WIDGET_CONTROL, wDraw, GET_VALUE=oWindow ; Retrieve the screen dimensions. oWindow->GetProperty, SCREEN_DIMENSIONS=screenDims, RESOLUTION=resolution ; Clean up. WIDGET_CONTROL, wBase, /DESTROY ; Return the screen dimensions. RETURN, screenDims END
Copyright © 1997-2000 David W. Fanning
Last Updated 8 February 2000