comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to see if variable is defined?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to see if variable is defined? [message #3435 is a reply to message #3359] Tue, 24 January 1995 08:22 Go to previous messageGo to previous message
rep2857 is currently offline  rep2857
Messages: 28
Registered: December 1994
Junior Member
In article <RFINCH.95Jan20094331@venice.water.ca.gov>,
Ralph Finch <rfinch@water.ca.gov> wrote:
> Is there a nice way of checking if a variable is defined?
>
> I have a widget_control command which removes a menu, and I need to
> see if the menu is defined before destroying it.

In the general case of checking whether a variable is defined you can
use the size() function. For example:

IDL> print, var
% PRINT: Variable is undefined: VAR.
% Execution halted at $MAIN$ (PRINT).
IDL> print, size(var)
0 0 1

The first parameter will be a zero if var is undefined.

For widgets in particular, the widget_info function has a "valid_id"
keyword which can check to see if the widget is a valid ID. Based on
the return from the call you can destroy the widget with
widget_control, /destroy.

if (Widget_Info(tac_base, /valid_id)) then $
Widget_Control, tac_base, /Destroy

Mike Schienle Hughes Santa Barbara Research Center
rep2857@sbsun0010.sbrc.hac.com 75 Coromar Drive, M/S B28/87
Voice: (805)562-7466 Fax: (805)562-7881 Goleta, CA 93117
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: autostart Wave license, Solaris 2.4
Next Topic: "True" map projections

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:04:57 PDT 2025

Total time taken to generate the page: 0.00463 seconds