Re: cgColor and Widget_Draw Frame problem [message #81851] |
Thu, 01 November 2012 15:15  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Helder writes:
> I now tried this procedure:
>
> PRO TestcgColor
> wBase = widget_base()
> wDrawColor = WIDGET_DRAW(wBase, XSIZE=100, YSIZE=100, FRAME=1)
> WIDGET_CONTROL, wBase, /REALIZE
> print,'Before wSet (without v):',!d.x_size, !d.y_size
> print,'Before wSet (with v):',!d.x_vsize, !d.y_vsize
> ThisWindow = !d.Window
> wSet, ThisWindow
> print,'After wSet (without v):',!d.x_size, !d.y_size
> print,'After wSet (with v):',!d.x_vsize, !d.y_vsize
> print, cgcolor('white')
> END
>
> Result:
>
> Before wSet (without v): 102 102
> Before wSet (with v): 102 102
> After wSet (without v): 100 100
> After wSet (with v): 100 100
> 16777215
>
> I'm running win 7 pro 64-bit.
>
> If I comment out the wSet command, I get the error.
>
> Ok, so I'm the only one having this error?
No, I see it now, too. Must not have had my coffee yet this morning. :-)
> I always use some where a wSet in my programs. And this is the first time that this appears. I was writing very very simple widget to run some test I was drawing something right after the creation of the widget (/REALIZE) and then I used cgColor() for figuring out the color. I do agree that this is not the normal way a widget program runs, but as I said it was supposed to be an easy and quick widget tool...
> As far as I'm concerned, I'm happy to call my window with wSet and then use cgColor, but I have something inside me wanting to understand where the error is originating (no, not in the way I wrote the widget code, but rather in the effect of wSet on !d.x_size and !d.y_size).
>
> I also checked the geometry of the widget, but that does not change before and after using wSet.
Well, it's weird, but it's not the weirdest thing I've ever seen when
working with widgets. Spend some time trying to get the largest
possible window on your display in a device-independent way, if
you REALLY want to have some fun with window sizes:
http://www.idlcoyote.com/code_tips/goldilocks.html
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.")
|
|
|