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

Home » Public Forums » archive » Re: How to retrieve information from an event to use it in another event?
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 retrieve information from an event to use it in another event? [message #54489] Tue, 19 June 2007 09:54 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Jun 19, 11:34 am, "aleks.fra...@gmail.com" <aleks.fra...@gmail.com>
wrote:
> On 19 jun, 11:55, Paul van Delst <Paul.vanDe...@noaa.gov> wrote:
>
>
>
>> aleks.fra...@gmail.com wrote:
>>> Hello!
>>> Maybe it's a likely simple question, but I can't figure it out. I have
>>> 2 buttons and I want them to communicate. My widget has 2 buttons and
>>> each button is a separate event. Button A chooses an image A to open.
>>> Button B chooses an image B to open. I need to keep the information
>>> from image A in order to compare with image B. Because they are 2
>>> separate events, when the first events ends ( opens image A ) all the
>>> information about image A is lost. What do I need to do to keep the
>>> information from an event and use it in another event?
>
>> What do you mean be "information from image A" ? The image itself (for comparison with
>> image B) or information about image A (e.g. size, min/max vals etc) ?
>
>> Asking the same question a bit more broadly: What, exactly, do you want your widget to do?
>
>> cheers,
>
>> paulv
>
>> --
>> Paul van Delst Ride lots.
>> CIMSS @ NOAA/NCEP/EMC Eddy Merckx
>
> Ok, I'll try it in another way.
>
> I have I have 2 buttons: Open1 and Open2
>
> ;Starts here
> CASE eventval OF
> 'Open1' :BEGIN
> cd,'c:\rsi\idl63\examples\data'
> envi_select, title="WAVECHANGE: Select 'Initial State' Image",$
> fid=fid1, dims=dims1, pos=pos1
>
> if (fid1 eq -1) then return
>
> envi_file_query, fid1, fname=fname1, bname=bname1,$
> data_type=data_type1,$
> ns=ns1, nl=nl1, nb=nb1,$
> sname=sname1, xstart=xstart1, ystart=ystart1
>
> WIDGET_CONTROL,(*pinfo).wOpen1,SENSITIVE=0
>
> WIDGET_CONTROL,(*pinfo).wOpen2,SENSITIVE=1
>
> END
>
> 'Open2' :BEGIN
>
> envi_select, title="WAVECHANGE: Select 'Final State' Image",$
> fid=fid2, dims=dims2, pos=pos2
>
> if (fid2 eq -1) then return
>
> envi_file_query, fid2, fname=fname2, bname=bname2,$
> data_type=data_type2,$
> ns=ns2, nl=nl2, nb=nb2,$
> sname=sname2, xstart=xstart2, ystart=ystart2
>
> name_pos = STRPOS(fname1, '\', /REVERSE_SEARCH)
> path=STRMID(fname1, 0,name_pos+1)
>
> ;;
> ;;_____HERE IS THE PROBLEM..
> ;;_____I need to compare fid1 with fid2, but the program kills all
> information from 'Open1' event
> ;;
> if (fid1 eq fid2) then begin
> message=[["You have selected the same image twice!"],[""],
> ["Please, select both images again"]]
> result=dialog_message (message,title="Error!", /error)
> return
> endif
>
> if (nb1 ne nb2) then begin
> message=[["The selected images must have the same number of
> bands!"],[""],["Please, select both images again"]]
> result=dialog_message (mensagem,title="Error!", /error)
> return
> endif
>
> END
>
> When I finish the first case, it seems that all the information about
> 'Open1' is killed. I need the variables from Open1 to use them im my
> 'Open2'. In other words, I need to retreave the variables: fid1, dim1,
> pos1, data_type1, ns1, nl1, nb1, sname1, xstart1, ystart1.
>
> I hope I was clear this time.
>
> Thank you.

make an info structure in your "main" program like:
info = {fid1:(-1), fid2:(-1), nb1:0L, nb2:0L .. etc }
make a pointer to that
infoptr = ptr_new(info)
in your event function put:
widget_control, event.top, get_uvalue=infoptr

Then you can look use (*infoptr).fid1, etc...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Encoding of IDL strings
Next Topic: Re: history of command prompt

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

Current Time: Wed Oct 08 18:24:44 PDT 2025

Total time taken to generate the page: 0.00242 seconds