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

Home » Public Forums » archive » Pointers to arrays in widget programs (PV-Wave and IDL)
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
Pointers to arrays in widget programs (PV-Wave and IDL) [message #3347] Wed, 07 December 1994 12:35
rep2857 is currently offline  rep2857
Messages: 28
Registered: December 1994
Junior Member
Hi all -

I've been using IDL for a couple years and just switched to PV-Wave.
One thing that I'd like to figure out how to do is use the Userdata
option in Wave to pass a pointer to an array which can be resized.
Here's what I mean in terms of IDL widget syntax, and what I thought
would work in WaveWidget syntax. I haven't been able to get this to
work correctly with WaveWidgets, though. The following were keyed in on
the fly and should be considered a concept, not actual running code.

IDL Version 3.6, Sun SS-10, SunOS 4.1.3.
Wave CL Version 4.2, Sun SS-10, SunOS 4.1.3.

IDL:
pro test
ptr = widget_base() ; unrealized base for use with UValue
fptr = widget_base(Group=ptr) ; unrealized base for use with UValue
fdata = 0 ; will eventually hold array of varying sizes
info = {$
data:0L, $
fptr:fptr}
; commands and widget layouts deleted
Widget_Control, fptr, Set_UValue=fdata
Widget_Control, ptr, Set_UValue=info
end

pro test_event, event
Widget_Control, event.top, Get_UValue=ptr
Widget_Control, ptr, Get_UValue=info, /No_Copy
Widget_Control, info.fptr, Get_UValue=fdata, /No_Copy
; commands deleted
; declare xsize and ysize based on some kind of data
; could be different size each time
fdata = bytarr(xsize, ysize)
Widget_Control, info.fptr, Set_UValue=fdata, /No_Copy
Widget_Control, ptr, Set_UValue=info, /No_Copy
end

Wave:
pro test
splash = WwInit('qmr', 'Qmr', bboard, /Board)
base = WwMainWindow(splash, layout, /Form)
fptr = WwMainWindow(layout)
abutton = WwButtonBox(layout, 'Button Label', 'test_event')
; commands and widget layouts deleted
fdata = 0
info = {, $
data:0L, $
abutton:abutton, $
base:base, $
fptr:fptr}
; if I remember correctly this next line will fail during compile
status = WwSetValue(info.fptr, Userdata=fdata)
status = WwSetValue(base, Userdata=info)
end

pro test_event, wid, data
info = WwGetValue(wid, /Userdata)
fdata = WwGetValue(info.fptr, /Userdata)
; unfortunately base and fdata are identical after this
; I would like fdata to be whatever I had stored in the userdata
; for base.fptr on a previous instance, typically an image array
fdata = bytarr(xsize, ysize)
status = WwSetValue(info.fptr, Userdata=fdata)
end

I was trying to put an application together for a demo in a very short
time, and will happily concede to making a stupid mistake if someone
can show me how to do this. In the interim, I've coded the demo with a
short common block, which I would rather avoid. I can provide more
thorough code examples through email if necessary. I've been able to
assign values and structures using the above type of declarations, but
I can't change the dimensions without giving the program fits.

Thanks,

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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: HELP: Multiple-file Applications
Next Topic: IDL histograms/PSYM

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

Current Time: Wed Oct 08 19:24:30 PDT 2025

Total time taken to generate the page: 0.00602 seconds