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

Home » Public Forums » archive » Re: Help with pick menu widget code
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: Help with pick menu widget code [message #12891 is a reply to message #12877] Tue, 15 September 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Doug Larson (djl@REMOVECAPSloki.srl.caltech.edu) writes:

> I am attempting to make a small program to pop up some menu
> buttons based on a user set resource. I am attaching the
> code to this post in the hopes that someone can tell me
> how to make it exit properly!
>
> My intent was to understand how to handle different
> combinations of widgets in one window. Even after repeated
> readings from "The Book of David" I still can't get this to go.

Whew! For a moment there I thought you were reading my
book, but then I had a look at the code. Since I *ALWAYS*
put the main program unit as the last one in the file, I
can tell it's not my book you are reading. :-)

You are not going to believe this Doug, but the only thing
this program is missing is that you forgot to get the
pointer in your button event handler. :-(

I added this line to the top of the PickFinish_Event
function:

Widget_Control, event.top, Get_UValue=pickPtr

Now it exits almost perfectly. There is one small problem,
however. And that is that you *did* remember to put the
pointer back at the end of the routine with this line:

WIDGET_CONTROL, event.top, SET_UVALUE= pickPtr, /NO_COPY

This piece of code fails now, however, because the action
of the DONE button is to destroy the top-level base. Of
course, you can't stick something into the user value
of a widget that no longer exists.

I might fix this problem like this:

IF Widget_Info(event.top, /Valid_ID) THEN $
WIDGET_CONTROL, event.top, SET_UVALUE= pickPtr, /NO_COPY

But, to tell you the truth, I wouldn't be fooling around with
NO_COPY keywords if what I'm passing around is a pointer. There
really is no point to it. (Pun intended.) A pointer is a two
byte integer. I wouldn't be worrying about getting it with a
NO_COPY and I wouldn't be worrying about putting it back. If you
have the pointer reference, you have the thing itself. There is
nothing whatsoever to copy.

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: -- WAV files and IDL --
Next Topic: Re: Cumulative total

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

Current Time: Sat Oct 11 05:02:08 PDT 2025

Total time taken to generate the page: 0.24342 seconds