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

Home » Public Forums » archive » Re: cgColor and Widget_Draw Frame problem
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: cgColor and Widget_Draw Frame problem [message #81861 is a reply to message #81854] Thu, 01 November 2012 07:23 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Helder writes:

> I've been using cgColor quite successfully for quite a while with this, but I started to get a strange problem.
> If I create a draw widget with a frame then cgColor throws an error.
> This is the code that generates the error:
>
> PRO TestcgColor
> wBase = widget_base()
> wDrawColor = WIDGET_DRAW(wBase, XSIZE=100, YSIZE=100, FRAME=1)
> WIDGET_CONTROL, wBase, /REALIZE
> print, !D.x_size, !D.y_size
> print, cgcolor('white')
> END
>
> And the error reads: "CGSNAPSHOT--> TVRD: Value of Area is out of allowed range."
>
> The reason is that the draw region that I generated is 100x100 pixel and the size of the window is given as 102x102 (1 pixel per side).
>
> Is there a way to overcome this problem?
> I think one can read the frame size from (widget_info(..., /geometry)).margin and then subtract this from !D.x_size and !D.y_size (actually 2*margin) when calculating the opposite pixel in cgColor().
>
> Does this make any sense or am I on the false track?

Sigh... If there is one thing I hate, it is widget geometry. :-(

Is this some kind of LINUX you are running on? What is the
result of printing !D.x_vsize, and !D.y_vsize? What version
of IDL is this? All of these things are going to matter.

All cgColor is trying to do is read the pixel "color" in the
upper right-hand corner of the graphics window. You might think
this would be a simple thing to do...

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: a behemoth bubble sort
Next Topic: One RETALL is not enough

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

Current Time: Fri Oct 10 20:31:16 PDT 2025

Total time taken to generate the page: 0.23970 seconds