[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IDLgrLegend geometry



Hi all,

I was resizing an IDLgrWindow object and noticed that objects such as
IDLgrAxis, IDLgrPlot,IDLgrText resized correctly to fit the new
dimensions, but IDLgrLegend did not.
This topic has been discussed in the past but with the demise of the
DejaNews news group database, I could not find any references.
So here is a work around that works well on the screen (IDLgrWindow) but
when you send the View to another output object such as IDLgrPrinter,
the fixed geometry of IDLgrLegend becomes a problem again.


;------------------------------------------------------------------------




PRO Resize_Events, event

    ; resize event handler.

Widget_Control, event.top, Get_UValue=info

    ;  Get old window dimension

info.thisWindow->GetProperty, Dimension=WDimOld

    ; Resize the draw widget.

info.thisWindow->SetProperty, Dimension=[event.x, event.y]

    ;  Resize the Legend. Calculate the size based on the x-width of the
window
    ;  This is a workaround to get the legend font to resize.
    ;  It works well on the screen (IDLgrWindow) but not on the printer
(IDLgrPrinter).

info.oLegend->GetProperty, Font=lFont
Font->GetProperty, Size=lChar
lFont->SetProperty, Size=lChar*event.x/WDimOld[0]

    ; Redisplay the graphic.

Widget_Control, Hourglass=1
info.thisWindow->Draw, info.oScene
Widget_Control, Hourglass=0

    ;Put the info structure back.

Widget_Control, event.top, Set_UValue=info, /No_Copy

END


;------------------------------------------------------------------------




Does anyone else have the same problem ?
If not, then what is the "proper" way to resize legends ?
If yes, then I am glad that I am not the only one. Did you solve the
problem irrespective of the output destination object, or you gave up in
discussed ?


George Constantinides
Manly Hydraulics Laboratory
email:  GeorgeC@mhl.nsw.gov.au
URL   http://www.mhl.nsw.gov.au