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

Home » Public Forums » archive » Problem with COMMON block
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
Problem with COMMON block [message #14800] Mon, 29 March 1999 00:00 Go to next message
VU KHAC Tri is currently offline  VU KHAC Tri
Messages: 25
Registered: March 1999
Junior Member
Hi folks,

I have written 2 following procedures, but IDL compilator signals an
error at
using "StdImage.FileName" since it does not know the definition of
StdImage in the COMMON block.
Could you tell my the reason and your solution ?
Thanks so much.
Best regard,
Tri.


;*********************************************************** ***
; procedure WindowLoadImage_event
;
; To manage all events of the WindowLoadImage
;*********************************************************** ***
pro WindowLoadImage_event, event
COMMON SHAREIMAGE
WIDGET_CONTROL, event.id, GET_UVALUE = selected
; define a temporal type
CASE selected OF
'LoadStdImage': BEGIN
fname = StdImage.FileName;
^^^^^^^^^^^^^^^^^^^^^^^^^
fname = DIALOG_PICKFILE(FILE = fname, GROUP =
LIWindow, $
/READ, FILTER = '*.hdr', /MUST_EXIST)
END
'LoadObjImage': BEGIN
END
ENDCASE
end

;*********************************************************** ***
; procedure WindowLoadImage
;
; the Window of LoadImage
;*********************************************************** ***
pro WindowLoadImage
COMMON SHAREIMAGE, StdImage, ObjImage
StdImage = {IMAGESTRUCT, Header:{HEADERSTRUCT, FileName:BYTARR(128),
Dimension:0, $
X_Dim:0, Y_Dim:0, Z_Dim:0, $
X_Size:0., Y_Size:0., Z_Size:0.}, $
Data:PTR_NEW()}

MW_XSize = 800 ; it must be at least equal 3*img_DrawSize
MW_YSize = 650
LIWindow = WIDGET_BASE(XSIZE = MW_XSize, YSIZE = MW_YSize, TITLE
=
'Load Images')
;****************
; Drawing windows
img_DrawSize = 256
img_XOffGap = (MW_XSize - 3 * img_DrawSize) / 4.0
img_YOffGap = 10
img_XOff = FIX(img_XOffGap)
img_YOff = img_XOffGap
StdImgDraw1 = WIDGET_DRAW(LIWindow, XSIZE = img_DrawSize, YSIZE
=
img_DrawSize, $
XOFFSET = img_XOff, YOFFSET = img_YOff, FRAME = 3,
COLORS = 256)
img_XOff = FIX(img_XOff + img_DrawSize + img_XOffGap)
StdImgDraw2 = WIDGET_DRAW(LIWindow, XSIZE = img_DrawSize, YSIZE
=
img_DrawSize, $
XOFFSET = img_XOff, YOFFSET = img_YOff, FRAME = 3,
COLORS = 256)
img_XOff = FIX(img_XOff + img_DrawSize + img_XOffGap)
StdImgDraw3 = WIDGET_DRAW(LIWindow, XSIZE = img_DrawSize, YSIZE
=
img_DrawSize, $
XOFFSET = img_XOff, YOFFSET = img_YOff, FRAME = 3,
COLORS = 256)
;****************
; Drawing buttons of range 1
img_XOff = FIX(img_XOffGap)
bt_YOff = img_YOffGap + img_DrawSize + 10
btSize = 60
btStdImgLoad = WIDGET_BUTTON(LIWindow, $
XOFFSET = img_XOff, YOFFSET = bt_YOff, XSIZE = btSize, $
VALUE = 'Load...', $
UVALUE = 'LoadStdImage')
;****************
; Drawing buttons of range 2
bt_YOff = MW_YSize - img_YOffGap - img_DrawSize - 30
btObjImgLoad = WIDGET_BUTTON(LIWindow, $
XOFFSET = img_XOff, YOFFSET = bt_YOff, XSIZE = btSize, $
VALUE = 'Load...', $
UVALUE = 'LoadObjImage')

WIDGET_CONTROL, LIWindow, /REALIZE
XMANAGER, 'WindowLoadImage', LIWindow
end
Re: Problem with COMMON block [message #14908 is a reply to message #14800] Thu, 01 April 1999 00:00 Go to previous message
Michael Werger is currently offline  Michael Werger
Messages: 34
Registered: May 1997
Member
VU KHAC Tri wrote:
>
> Hi folks,
>
> I have written 2 following procedures, but IDL compilator signals an
> error at
> using "StdImage.FileName" since it does not know the definition of
> StdImage in the COMMON block.
> Could you tell my the reason and your solution ?

> pro WindowLoadImage_event, event
> COMMON SHAREIMAGE

change this line into:

COMMON SHAREIMAGE, StdImage, ObjImage


> WIDGET_CONTROL, event.id, GET_UVALUE = selected
> ; define a temporal type
> ...

Still doesn't work? Then try to avoid COMMON (recommended).
Just put all your required variables in a structure
and put this into the base widget uvalue or value
then you may easily read/write this again -

If you need to know more, just send me an email (but think
of the easter holidays...)


--
Michael Werger ------------o
ESA ESTEC & Praesepe B.V. |
Astrophysics Division mwerger@astro.estec.esa.nl|
| Postbus 299 http://astro.estec.esa.nl |
| 2200 AG Noordwijk +31 71 565 3783 (Voice)
o------------------- The Netherlands +31 71 565 4690 (FAX)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: WRITE_TIFF
Next Topic: Re: axis annotations: tickmarks

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

Current Time: Wed Oct 08 18:39:19 PDT 2025

Total time taken to generate the page: 0.00497 seconds