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

Home » Public Forums » archive » Listing all top-level widgets
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
Listing all top-level widgets [message #18638] Wed, 26 January 2000 00:00 Go to next message
James Tappin is currently offline  James Tappin
Messages: 54
Registered: December 1995
Member
Is anyone aware of any way to generate a list of all the currently realized
top-level widgets (or better still all the realized modal top-level widgets
but getting that once provided with a list of all tlb's is easy)?

The only ways I can think of are:
1)
for j =0l, largest_long do begin
if (widget_info(j,/valid)) then begin
if (widget_info(j, /parent) eq 0 and widget_info(j,/modal)) then$
imodal = 1
endif
endif
endfor

Which would take forever to run

2) Require that any modal top-level base deposit it's ID in a common block
3) Dig out where the information is stored within xmanager (and hope that
there are no modal widgets that don't use xmanager

Or maybe there's a more elegant solution altogether to this problem, namely:
I have a menu that pops up when a file search fails, and it is possible that
the routine that called the file search was triggered from a modal menu, but
it's about half-a-dozen calls away so passing a group-leader ID down the
calling chain isn't really practical.

James
--
+------------------------+-------------------------------+-- -------+
| James Tappin | School of Physics & Astronomy | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722 | |
+--------------------------------------------------------+-- -------+
Re: Listing all top-level widgets [message #18736 is a reply to message #18638] Mon, 31 January 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
William Thompson (thompson@orpheus.nascom.nasa.gov) writes:

> davidf@dfanning.com (David Fanning) writes:
>
>> Well, now you mention it, I have a program running from
>> a modal widget and it *does* seem to generate events--much
>> to my consternation. These things just seem to have no respect
>> for learned opinion. :-(
>
> Your consternation would be my delight. ;^) I've never understood why modal
> widgets are no longer supposed to have child widgets.

Uh, well, on further inquiry it turned out to be
programmer error. "Children" of modal widgets CANNOT
generate events.

Sorry for the confusion.

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Listing all top-level widgets [message #18738 is a reply to message #18638] Mon, 31 January 2000 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
davidf@dfanning.com (David Fanning) writes:

> Well, now you mention it, I have a program running from
> a modal widget and it *does* seem to generate events--much
> to my consternation. These things just seem to have no respect
> for learned opinion. :-(

Your consternation would be my delight. ;^) I've never understood why modal
widgets are no longer supposed to have child widgets.

Cheers,

Bill Thompson
Re: Listing all top-level widgets [message #18747 is a reply to message #18638] Sat, 29 January 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Liam Gumley (Liam.Gumley@ssec.wisc.edu) writes:

> Strange...
> I just tried the following program in IDL 5.3 under Windows 98:
>
> When I run this program with the button de-sensitized, nothing happens when
> I click on the button, e.g.
>
> However when the button is sensitized, it generates events as expected:

Whoops! Yes, this behavior has been fixed in IDL 5.3!
Good job, RSI.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Listing all top-level widgets [message #18750 is a reply to message #18638] Fri, 28 January 2000 00:00 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
David Fanning <davidf@dfanning.com> wrote in message
news:MPG.12fa2fc4c60fed3989a01@news.frii.com...
> William Thompson (thompson@orpheus.nascom.nasa.gov) writes:
>
>> It used to be the case that modal widgets were allowed to have child
widgets.
>> However, this capability went away when RSI decided to move the /MODAL
keyword
>> from the XMANAGER call to the call to WIDGET_BASE. This severely
restricted
>> the usefulness of modal widgets, and we've had to emulate the /MODAL
>> functionality by having the modal-like widget desensitize its caller,
and then
>> remember to resensitize it when it's done.
>
> I've got bad news for you, Bill. On Windows NT at least, desensitized
widgets
> *still* generate events. Although if you are lucky the desensitized look
will
> discourage users from clicking all your controls just to see what happens.
:-)

Strange...
I just tried the following program in IDL 5.3 under Windows 98:

PRO WHELLO_EVENT, EVENT
widget_control, event.id, get_uvalue=uvalue
if (uvalue eq 'OK') then print, 'OK event detected'
END

PRO WHELLO, SENSITIVE=SENSITIVE

;- Create widgets
base = widget_base(/column, xoffset=300, yoffset=300)
label = widget_label(base, value='Hello world')
button = widget_button(base, value='OK', uvalue='OK')
widget_control, base, /realize
widget_control, button, sensitive=keyword_set(sensitive)

;- Start event manager
xmanager, 'whello', base

END

When I run this program with the button de-sensitized, nothing happens when
I click on the button, e.g.

IDL> whello

However when the button is sensitized, it generates events as expected:

IDL> whello, /sensitive

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
Re: Listing all top-level widgets [message #18756 is a reply to message #18638] Thu, 27 January 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
William Thompson (thompson@orpheus.nascom.nasa.gov) writes:

> It used to be the case that modal widgets were allowed to have child widgets.
> However, this capability went away when RSI decided to move the /MODAL keyword
> from the XMANAGER call to the call to WIDGET_BASE. This severely restricted
> the usefulness of modal widgets, and we've had to emulate the /MODAL
> functionality by having the modal-like widget desensitize its caller, and then
> remember to resensitize it when it's done.

I've got bad news for you, Bill. On Windows NT at least, desensitized widgets
*still* generate events. Although if you are lucky the desensitized look will
discourage users from clicking all your controls just to see what happens. :-)

> We also needed to add some funny
> business with a timer widget in the calling routine so that it would know that
> the modal-like widget was done, and it could do something with the answer.

Yuck. I normally write Modal widgets as functions that will
return whatever information I am looking for when the widget
is destroyed.

> It's been a while since I've tried it, but I believe that a modal widget can
> have a modal child widget. Perhaps that would solve James's problem?

Well, now you mention it, I have a program running from
a modal widget and it *does* seem to generate events--much
to my consternation. These things just seem to have no respect
for learned opinion. :-(

Another item for the To Do list, I guess.

> Personally, I'm very disappointed with the restrictions of the present
> implementation of modal widgets compared with what we used to be able to do.
> From now on, unless the widget is extremely simple, I'll be avoiding modal
> widgets.

I'm big on non-modal object widgets, but--of course--they are
too difficult to write unless you are getting paid the big bucks. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Listing all top-level widgets [message #18769 is a reply to message #18638] Thu, 27 January 2000 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
davidf@dfanning.com (David Fanning) writes:

> James Tappin (sjt@star.sr.bham.ac.uk) writes:

>> Is anyone aware of any way to generate a list of all the currently realized
>> top-level widgets (or better still all the realized modal top-level widgets
>> but getting that once provided with a list of all tlb's is easy)?

> The idea that comes immediately to mind for me is to write
> an object that "checks out" top-level base widgets. But
> objects are so incredibly difficult to write that you
> practically have to be a genus to write one. :-)

>> 2) Require that any modal top-level base deposit it's ID in a common block
>> 3) Dig out where the information is stored within xmanager (and hope that
>> there are no modal widgets that don't use xmanager
>>
>> Or maybe there's a more elegant solution altogether to this problem, namely:
>> I have a menu that pops up when a file search fails, and it is possible that
>> the routine that called the file search was triggered from a modal menu, but
>> it's about half-a-dozen calls away so passing a group-leader ID down the
>> calling chain isn't really practical.

> I think one or the other of us is confused about what "modal"
> means. I am certain that any widget program "triggered"
> by a button from a modal widget is--almost by definition--
> guaranteed NOT to generate events itself. At least I've
> never gotten it to work.

David:

It used to be the case that modal widgets were allowed to have child widgets.
However, this capability went away when RSI decided to move the /MODAL keyword
from the XMANAGER call to the call to WIDGET_BASE. This severely restricted
the usefulness of modal widgets, and we've had to emulate the /MODAL
functionality by having the modal-like widget desensitize its caller, and then
remember to resensitize it when it's done. We also needed to add some funny
business with a timer widget in the calling routine so that it would know that
the modal-like widget was done, and it could do something with the answer.

For a while we were able to use the old style of modal widgets in IDL versions
5.1 and 5.2 with a slightly hacked version of xmanager.pro supplied to us by
RSI, but this had to be abandoned with IDL version 5.3. I think that we have
everything working now in v5.3, but there may still be something lurking
somewhere in our code that we haven't run into yet.

It's been a while since I've tried it, but I believe that a modal widget can
have a modal child widget. Perhaps that would solve James's problem?

Personally, I'm very disappointed with the restrictions of the present
implementation of modal widgets compared with what we used to be able to do.
From now on, unless the widget is extremely simple, I'll be avoiding modal
widgets.

William Thompson
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to call C program from IDL??
Next Topic: read_gif on SUN

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

Current Time: Wed Oct 08 20:06:00 PDT 2025

Total time taken to generate the page: 0.68843 seconds