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

Home » Public Forums » archive » Re: Legend for plot
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: Legend for plot [message #67981 is a reply to message #67979] Tue, 15 September 2009 17:58 Go to previous messageGo to previous message
b.a is currently offline  b.a
Messages: 26
Registered: July 2009
Junior Member
Thanks for your solution. But I couldn't get it to work. What happens
now, is that I get 3 separate window: one for my GUI (a simple tlb and
draw widget), one for the legend (but the legend doesn't appear in it)
and one for my plots.

Here is the code that I tried:
----------------------------------------------------
pro demolegend

x1 = [1,2,3,4,5]
y1 = [4,5,6,7,8]

x2 = [2,3,4,4.5,5]
y2 = [4,5,6,7,8]

tlb = Widget_Base(column=1, XSIZE=350, YSIZE= 400,$
XOFFSET=250, YOFFSET= 300)

dr_window = WIDGET_DRAW(tlb, UVALUE= 'draw', $
XSIZE= 348, YSIZE=200, GRAPHICS_LEVEL = 2)

mywindow = OBJ_NEW('IDLgrWindow')
myview = OBJ_NEW('IDLgrView')

itemNameArr = ['One', 'two']

myLegend = OBJ_NEW('IDLgrLegend', itemNameArr)
myview->Add, mylegend

WIDGET_CONTROL, dr_window, GET_VALUE = mywindow
;mywindow->Draw, myview

Widget_Control, tlb, /realize

plot, y2, x2, COLOR= 40, BACKGROUND= 255
oplot, y1, x1, COLOR= 80

Xmanager, 'demolegend', tlb

end
------------------------------------------------------------ ----------

as you see, I have commented this line:
;mywindow->Draw, myview

If I don't do that, it gives error:
Unable to invoke method on NULL object reference: <OBJREF
(<NullObject>)>.
ehich I think means that mywindow is a null object.

Can you think of any solution for this?

Thank you
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL on the web?
Next Topic: iplot colorbar label

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

Current Time: Fri Oct 10 03:11:55 PDT 2025

Total time taken to generate the page: 0.00587 seconds