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

Home » Public Forums » archive » Re: ? Weird DRAW widget VALUE ?
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
Re: ? Weird DRAW widget VALUE ? [message #14131] Fri, 29 January 1999 00:00
rmlongfield is currently offline  rmlongfield
Messages: 68
Registered: August 1998
Member
In article <78q454$rvr$1@news.rz.uni-karlsruhe.de>,
Peter Cornelius <pcNOSPAM@inr.fzk.de> wrote:
> Re...see earlier post for details

Hi Peter, Seeing your code helps a lot. You don't need to send draw288_id
through the COMMON block. You must send draw288 (the widget ID for
WIDGET_DRAW). Then you can get draw288_id back using
WIDGET_CONTROL,draw288,GET_VALUE=draw288_id And then you can write
WSET,draw288_id

It might be useful to label your variables carefully. I try to put the
letters 'ID' only at the end of widget ID's (drawID = WIDGET_DRAW(...).
Also, when you "Get_Value" a value in your event handler, the variable name
can be anything. It helps if its name is related to what you expect to be
inside, i.e. buttonvalue or windowvalue (although if there is an error, this
can help add to the confusion, as in your case with the string). The word
"value" is used a lot in the documentation and refers sometimes to different
things. For me, the uvalue was the most difficult to understand (It can be
anything you want, but they never offer any suggestions to a beginner). I
use it now as a miniature package with information that the event handler
needs to know.

I used WIDED a lot when I started working with widgets. It is not a bad
program for getting used to how widgets work.

Rose

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: ? Weird DRAW widget VALUE ? [message #14135 is a reply to message #14131] Thu, 28 January 1999 00:00 Go to previous message
Peter Cornelius is currently offline  Peter Cornelius
Messages: 6
Registered: January 1999
Junior Member
Re...

Thank you very much for your responses:

David Foster <foster@bial1.ucsd.edu> wrote:

> I would guess that the order of parameters in your common-block
> is incorrect, as the string you are getting looks like it's
> associated with a button or label widget, and you're passing
> this widget to CW_DEFROI().

<rmlongfield@my-dejanews.com> wrote:

> It looks to me that DRAW288_Id is not the ID of WIDGET_DRAW. Try printing it
> in the main program and then print it again in the event program to check
> whether they are the same number. I am also puzzled about why you write
> earlier : WSET, DRAW288_Id since this is the WIDGET_DRAW id and not the window
> ID. Maybe WSET is messing up the DRAW288_Id somehow.

Well, maybe both of you are right, I don't really know. DRAW288_Id does
work with all WSETs that occur in the code. But it contains the 'IDL window
number' (says the manual):

PRO MainProg, GROUP=Group
[...]
DRAW288 = WIDGET_DRAW( BASE290, $
BUTTON_EVENTS=1, $
MOTION_EVENTS=1, $
RETAIN=2, $
UVALUE='MainViewDraw', $
XSIZE=741, $
YSIZE=574)
[...]
WIDGET_CONTROL, DRAW288, GET_VALUE=DRAW288_Id
[...]
END

This window number (more or less) obviously is something different
from a 'window id', which in this case is stored in DRAW288. And
CW_DEFROI only accepts window ids, not window numbers. So, for
the time being, I added DRAW288 to my DRAW_Comm block, and it now
sort of works. Thanks a lot.

Still though, the STRING persists, but it seems not to do any harm
(here and at this point...). Just to close this thread, here's the
code snippet:

[...]
'DISPLAY.Display Mode.ROI': BEGIN
MESSAGE, 'Event for DISPLAY.Display Mode.ROI', /INFORMATIONAL
JUNK = WIDGET_INFO(DRAW288_Id, /NAME)
PRINT, 'HELP, JUNK :' & HELP, JUNK
WSET, DRAW288_Id
WIDGET_CONTROL, DRAW288_Id, GET_VALUE=win
PRINT, 'HELP, WIN :' & HELP, win
PRINT, 'HELP, DRAW288_Id :' & HELP, DRAW288_Id
PRINT, 'HELP, DRAW288 :' & HELP, DRAW288
ROI=CW_DEFROI(DRAW288,/RESTORE)
PRINT, 'HELP, ROI :' & HELP, ROI
END
[...]

now produces:

% PDMENU298_EVENT: Event for DISPLAY.Display Mode.ROI
HELP, JUNK :
JUNK STRING = 'BUTTON'
HELP, WIN :
WIN STRING = 'Display Mode'
HELP, DRAW288_Id :
DRAW288_ID (DRAW_COMM)
LONG = 32
HELP, DRAW288 :
DRAW288 (DRAW_COMM)
LONG = 52
% Compiled module: CW_DEFROI.
% Compiled module: CW_BGROUP.
HELP, ROI :
ROI LONG = Array(57730)

I'm afraid, I'll have to leave that to those with further insight.
Ask me if I can be of any help, if there's still interest in this.

Now, after another lenghty posting, thank you all again, I will now
go on and try to produce some other image from this ROI array...

Best regards,

Peter.
---
Peter Cornelius <pcNOSPAM@inr.fzk.de>
Re: ? Weird DRAW widget VALUE ? [message #14140 is a reply to message #14135] Thu, 28 January 1999 00:00 Go to previous message
rmlongfield is currently offline  rmlongfield
Messages: 68
Registered: August 1998
Member
In article <36AEF212.DA00E826@inr.fzk.de>,
Peter Cornelius <pc@inr.fzk.de> wrote:
> Re again...
>
> With IDL 4.0.1 on Windoze95, I am trying to use some code like:
>
> [...]
> PRO PDMENU298_Event, Event
>
> COMMON DRAW_Comm
>
> CASE Event.Value OF
> [...]
> 'DISPLAY.Display Mode.ROI': BEGIN
> MESSAGE, 'Event for DISPLAY.Display Mode.ROI', /INFORMATIONAL
> WSET, DRAW288_Id
> WIDGET_CONTROL, DRAW288_Id, GET_VALUE=win
> HELP, DRAW288_Id
> HELP, win
> ROI=CW_DEFROI(DRAW288_Id)
> HELP, ROI
> END
> [...]
> ENDCASE
> END
> [...]
>
> But what I get is the following:
>
> % PDMENU298_EVENT: Event for DISPLAY.Display Mode.ROI
> DRAW288_ID (DRAW_COMM)
> LONG = 32
> WIN STRING = 'Display Mode'
...some stuff clipped...
> Now, I expect CW_DEFROI to be in order, what puzzles
> me is that I get STRING as return, although the DRAW288_Id
> is ok (it's in the COMMON DRAW_Comm block 8-S). In CW_DEFROI,
> it hangs just at the lines
>
> [...]
> WIDGET_CONTROL, draw, GET_VALUE=win
> WSET, win
> [...]
>
> which obviously doesn't work with a STRING. Is there anyone who
> can give me a hint how this STRING could have gotten into
> win?
>

Hi Peter,
Your statement: WIDGET_CONTROL, draw, GET_VALUE=win
is getting a value from "draw" but I suspect that "draw" is not the drawID of
the WIDGET_DRAW. Do you have a button widget defined with the value of WIN?

> WIN STRING = 'Display Mode'

It looks to me that DRAW288_Id is not the ID of WIDGET_DRAW. Try printing it
in the main program and then print it again in the event program to check
whether they are the same number. I am also puzzled about why you write
earlier : WSET, DRAW288_Id since this is the WIDGET_DRAW id and not the window
ID. Maybe WSET is messing up the DRAW288_Id somehow.

Hope this helps.
Rose

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: ? Weird DRAW widget VALUE ? [message #14141 is a reply to message #14135] Wed, 27 January 1999 00:00 Go to previous message
Peter Cornelius is currently offline  Peter Cornelius
Messages: 6
Registered: January 1999
Junior Member
Hi,

first of all: Thanks a lot for the support. I do appreciate
that very much.

David Foster <foster@bial1.ucsd.edu> wrote:
: First suggestion, get rid of common blocks! Store "state" information
: in a structure, create a pointer that points to it, and store this
: pointer as the UVALUE of the top-level-base widget.

Well, it was meant to be a quick and dirty hack... And now,
it seems to be ugly, too, from a programmers point of view 8-S
But I'm not a programmer,... but you're right, common blocks
are thorn bushes... you have to cut deep and watch about the
place for a while afterwards...

: I would guess that the order of parameters in your common-block
: is incorrect, as the string you are getting looks like it's
: associated with a button or label widget, and you're passing
: this widget to CW_DEFROI().

Why is order so important? DRAW_Comm contains widget ids, that's
correct, but only of my DRAW widgets... So far there isn't any
common block for button widgets ;-)==) (one could change that,
of course... >:-)==)).

In the main program, the buttons are created with:

MenuDesc173 = [ $
{ CW_PDMENU_S, 1, 'FILE' }, $ ; 0
[...]
{ CW_PDMENU_S, 1, 'DISPLAY' }, $ ; 23
[...]
{ CW_PDMENU_S, 1, 'Display Mode' }, $ ; 26
{ CW_PDMENU_S, 0, '2D/Profiles' }, $ ; 27
{ CW_PDMENU_S, 0, '2D/Click' }, $ ; 28
{ CW_PDMENU_S, 0, '3D' }, $ ; 29
{ CW_PDMENU_S, 2, 'ROI' }, $ ; 30
[...]
]

PDMENU298 = CW_PDMENU( BASE241, MenuDesc173, /RETURN_FULL_NAME, $
UVALUE='TopPullDown')

Typical wided output that is (please don't cry 8-S).

Regards,

Peter.

---
Peter Cornelius <pc***NOSPAM***@inr.fzk.de>
Re: ? Weird DRAW widget VALUE ? [message #14142 is a reply to message #14141] Wed, 27 January 1999 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Peter Cornelius wrote:
>
> Re again...
>
> With IDL 4.0.1 on Windoze95, I am trying to use some code like:
>
> [...]
> PRO PDMENU298_Event, Event
>
> COMMON DRAW_Comm
>
> CASE Event.Value OF
> [...]
> 'DISPLAY.Display Mode.ROI': BEGIN
> MESSAGE, 'Event for DISPLAY.Display Mode.ROI', /INFORMATIONAL
> WSET, DRAW288_Id
> WIDGET_CONTROL, DRAW288_Id, GET_VALUE=win
> HELP, DRAW288_Id
> HELP, win
> ROI=CW_DEFROI(DRAW288_Id)
> HELP, ROI
> END
> [...]
> ENDCASE
> END
> [...]
>
> But what I get is the following:
>
> % PDMENU298_EVENT: Event for DISPLAY.Display Mode.ROI
> DRAW288_ID (DRAW_COMM)
> LONG = 32
> WIN STRING = 'Display Mode'
> % Compiled module: CW_DEFROI.
> % Compiled module: CW_BGROUP.
> % Type conversion error: Unable to convert
> given STRING to Long.
> % Detected at: CW_DEFROI 232
> c:\progra~1\rsi\idl40\lib\cw_defro.pro
> % Type conversion error: Unable to convert
> given STRING to Long.
> % Detected at: CW_DEFROI 242
> c:\progra~1\rsi\idl40\lib\cw_defro.pro
> % Type conversion error: Unable to convert
> given STRING to Long.
> % Detected at: CW_DEFROI 264
> c:\progra~1\rsi\idl40\lib\cw_defro.pro
> ROI LONG = -1
>
> Now, I expect CW_DEFROI to be in order, what puzzles
> me is that I get STRING as return, although the DRAW288_Id
> is ok (it's in the COMMON DRAW_Comm block 8-S). In CW_DEFROI,
> it hangs just at the lines
>
> [...]
> WIDGET_CONTROL, draw, GET_VALUE=win
> WSET, win
> [...]
>
> which obviously doesn't work with a STRING. Is there anyone who
> can give me a hint how this STRING could have gotten into
> win?

First suggestion, get rid of common blocks! Store "state" information
in a structure, create a pointer that points to it, and store this
pointer as the UVALUE of the top-level-base widget.

I would guess that the order of parameters in your common-block
is incorrect, as the string you are getting looks like it's
associated with a button or label widget, and you're passing
this widget to CW_DEFROI().

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ENVI - IDL display question
Next Topic: disappearing feature?

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

Current Time: Wed Oct 08 13:33:37 PDT 2025

Total time taken to generate the page: 0.01107 seconds