Re: Beginner going INSANE [message #21796 is a reply to message #21787] |
Thu, 21 September 2000 00:00   |
angerelle
Messages: 1 Registered: September 2000
|
Junior Member |
|
|
There are PV-WAVE users out here! We're just not all working in US
timezones!
I've knocked up a quick example for two text boxes using common blocks
to pass around the array that needs to be changed plus the widget ids so
that I can switch on wid to work out which element to set.
---------8<-----beginnerwidget.pro -------------
PRO get_data_cb, wid, data
COMMON Stored, data_store, text0, text1
; need to have common block with array that we want to alter, and all
; of the widget ids for the text boxes. After this first declaration
; the size of the common block can't grow, so make sure that you've
; got everything you want in here, because common blocks are
; persistent during the whole of a PV-WAVE session!
; Get the typed text, should probably do some type checking
; (with SIZE for example) to check that it's suitable for your array
value = WwGetValue(wid)
; Switch on wid to find out which text box was set, and change
; appropriate array element
CASE wid OF
text0: data_store(0) = value
text1: data_store(1) = value
ELSE: ; do nothing
ENDCASE
; data_store should have been changed!
PRINT, data_store
END
PRO Beginnerwidget
COMMON Stored, data_store, text0, text1
; any old numbers to make it easy
data_store = INDGEN(12)
top = WwInit('test', 'test', layout, /form)
text0 = WwText(layout, 'get_data_cb', cols = 10, /left, /top, $
label="data_store(0)")
text1 = WwText(layout, 'get_data_cb', cols = 10, top=text0, /left, $
label="data_store(1)")
status = WwSetValue(top, /Display)
WwLoop
END
-------------------------8<---------------
Hope this helps,
Angela
> My first thought on reading this question was that
> this would certainly flush all the PV-Wave users
> out of hiding. But now, seeing that Andy has had
> to reply three times to his own post, I'm not sure
> there *are* any PV-Wave users in hiding. :-(
>
> Perhaps it's time we voted to change the name
> of this group. Since the Cobra people left, we
> can probably get the old comp.lang.idl name
> back for a song. :-)
>
Sent via Deja.com http://www.deja.com/
Before you buy.
|
|
|