;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME: findtopid ; ; PURPOSE: retrouve a partir d''un Id de widget l'Id du widget qui est ; "the top-level base" (i.e., it has no parent) ; ; CATEGORY: aide pour les widgets ; ; CALLING SEQUENCE: res=findtopid(Widget_ID) ; ; INPUTS: Widget_ID: this argument should be the widget ID of the ; widget for which information is desired. ; ; KEYWORD PARAMETERS: ; ; OUTPUTS: l'Id du widget qui est "the top-level base" ; ; COMMON BLOCKS: ; ; SIDE EFFECTS: ; ; RESTRICTIONS: ; ; EXAMPLE: ; ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) ; 22/9/1999 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ FUNCTION findtopid, identite ; compile_opt idl2, strictarrsubs ; id = long(identite) ; exist = widget_info(id, /managed) ; if exist EQ 0 then return, -1 topid = id topid2 = id while topid2 NE 0 do begin topid = topid2 topid2 = widget_info(topid2, /parent) endwhile return, long(topid) end