; $Id: xregistered.pro,v 1.1 1993/04/02 19:54:08 idl Exp $ ; Copyright (c) 1992-1993, Research Systems, Inc. All rights reserved. ; Unauthorized reproduction prohibited. function XRegistered, NAME, NOSHOW = NOSHOW ;+ ; NAME: ; XREGISTERED ; ; PURPOSE: ; This function returns true if the widget named as its argument ; is currently registered with the XMANAGER as an exclusive widget, ; otherwise this routine returns false. ; ; CATEGORY: ; Widgets. ; ; CALLING SEQUENCE: ; Result = XREGISTERED(Name) ; ; INPUTS: ; Name: A string containing the name of the widget in question. ; ; KEYWORD PARAMETERS: ; NOSHOW: If the widget in question is registered, it is brought ; to the front of all the other windows by default. Set this ; keyword to keep the widget from being brought to the front. ; ; OUTPUTS: ; If the named widget is registered, XREGISTERED returns the number ; of instances of that name in the list maintained by XMANAGER. ; Otherwise, XREGISTERED returns 0. ; ; COMMON BLOCKS: ; MANAGED ; ; SIDE EFFECTS: ; Brings the widget to the front of the desktop if it finds one. ; ; RESTRICTIONS: ; None. ; ; PROCEDURE: ; Searches the list of exclusive widget names and if a match is found ; with the one in question, the return value is modified. ; ; MODIFICATION HISTORY: ; Written by Steve Richards, November, 1990 ; Jan, 92 - SMR Fixed a bug where an invalid widget ; was being referenced with ; WIDGET_CONTROL and the /SHOW keyword. ;- COMMON MANAGED, ids, names, $ nummanaged, inuseflag, $ backroutines, backids, backnumber, nbacks, validbacks, $ blocksize, $ cleanups, $ outermodal answer = 0 IF(KEYWORD_SET(nummanaged)) THEN $ registered = WHERE(names EQ NAME, answer) IF(answer NE 0) THEN BEGIN ;if registered validids = WIDGET_INFO(ids(registered), /VALID) IF((validids(0) EQ 1) AND $ (NOT(KEYWORD_SET(NOSHOW)))) THEN $ WIDGET_CONTROL, ids(registered(0)), /SHOW ENDIF RETURN, answer END