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

Home » Public Forums » archive » widget IDs ever zero?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
widget IDs ever zero? [message #40904] Thu, 09 September 2004 12:19 Go to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
Hi all,

just to make sure before I run into trouble -- a widget ID will never be
zero, right? I want to use it for a program to know whether or not some
other widget program exists. Zero would mean the widget doesn't exist,
and if it does exist, the variable would hold the actual widget ID of
the TLB.

Thanks,
Benjamin
Re: widget IDs ever zero? [message #41052 is a reply to message #40904] Thu, 23 September 2004 17:49 Go to previous messageGo to next message
algosat is currently offline  algosat
Messages: 7
Registered: September 2004
Junior Member
>>
>> what if you dont have, or you lose, the widget id of a widget that is
>> realized? how do you find it again?
>
> How about this:
>
> for i=0,10000 do $
> if widget_info(i, /VALID) && widget_info(i, /REALIZED) then print, i
>
> Then it's up to you to work out which is which!
>
> But I must say I've never actually wanted to do this.
>

I managed to find a solution yesterday after posting the message. I
have created a function that lets the user find the widget ID of any
realized widget by specifying the uname of the widget, rather than an
id (which is the thing I lost in the first place), and lets face it we
are more inclined to know the uname of our desired widget rather than
the user id. We only want the widget ID on demand as per-normal. This
has been great for set routines on compound widgets, finding the id of
the widget containing the state (without having to maintain a constant
link with the tlb). I will post it later today (WIDGET ID FINDING
FUNCTION), let me know what you think. I am a little bit amazed that
this isnt elsewhere (hope im not reinventing the wheel here).

Cheers
Andrew
Re: widget IDs ever zero? [message #41066 is a reply to message #40904] Wed, 22 September 2004 19:43 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Andrew Rodger wrote:
>
> what if you dont have, or you lose, the widget id of a widget that is
> realized? how do you find it again?

How about this:

for i=0,10000 do $
if widget_info(i, /VALID) && widget_info(i, /REALIZED) then print, i

Then it's up to you to work out which is which!

But I must say I've never actually wanted to do this.

If you want to find and destroy dangling widgets,

widget_control, /RESET

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: widget IDs ever zero? [message #41187 is a reply to message #40904] Fri, 24 September 2004 18:35 Go to previous message
algosat is currently offline  algosat
Messages: 7
Registered: September 2004
Junior Member
> Have you tried running more than one widget program at a time,
> Andrew, each with the same UNAME for the storage widget? I'm
> thinking your program might become a bit confused at that point. :-)
>
> Which of the several managed widgets, each with the same UNAME
> should you return?
>

I think the code in its current form would get mighty confused :)
I only imagine this happening when multiple instances of the same
widget are running on the same computer. In my case this is not often
(never to date).
Otherwise I reference the state data for any given widget by

widget_control,widget_info(find_wid('specific_tlb'),/CHILD), get_uvalue=state

This of course will still suffer the same problem when two or more
instances of the same program are running. This is something I will
have a think on though.

If I am only running a single version of a GUI (and associated popups)
then I try and avoid generic names for the uvalue. If I am using a CW
I am usually passing in the uname. Works well in these situations.

Cheers
Andrew
Re: widget IDs ever zero? [message #41198 is a reply to message #41052] Fri, 24 September 2004 00:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Andrew Rodger wrote:

> I managed to find a solution yesterday after posting the message. I
> have created a function that lets the user find the widget ID of any
> realized widget by specifying the uname of the widget, rather than an
> id (which is the thing I lost in the first place), and lets face it we
> are more inclined to know the uname of our desired widget rather than
> the user id. We only want the widget ID on demand as per-normal. This
> has been great for set routines on compound widgets, finding the id of
> the widget containing the state (without having to maintain a constant
> link with the tlb). I will post it later today (WIDGET ID FINDING
> FUNCTION), let me know what you think. I am a little bit amazed that
> this isnt elsewhere (hope im not reinventing the wheel here).

Have you tried running more than one widget program at a time,
Andrew, each with the same UNAME for the storage widget? I'm
thinking your program might become a bit confused at that point. :-)

Which of the several managed widgets, each with the same UNAME
should you return?

Cheers,

David
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Colored image
Next Topic: Unique system identified?

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

Current Time: Sat Oct 11 09:13:01 PDT 2025

Total time taken to generate the page: 1.94947 seconds