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

Re: IDLgrLegend geometry

Mark Hadfield wrote:

> "David Fanning" <davidf@dfanning.com> wrote in message
> MPG.150498b583111c38989d69@news.frii.com">news:MPG.150498b583111c38989d69@news.frii.com...
> > George Constantinides (gconstantinides@mhl.nsw.gov.au) writes:
> >
> > > 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.
> > > [...]
> >
> > Humm. It's pretty clear that the author of IDLgrLegend
> > was *trying* to solve this problem in the ComputeDimensions
> > method. Have you tried using this when you resize or change
> > to another destination device? It looks to me like this
> > would solve all your problems, although I confess I've
> > never used IDLgrLegend.

I tried calling ComputeDimensions explicitly but I was not making any sense
of the result so I gave up on this approach.

> From my reading of the IDLgrLegend code in version 5.4, ComputeDimensions is
> called every time the legend is re-drawn, so there should be no need to call
> it manually. ComputeDimensions recalculates the dimensions of the legend's
> atoms based on the character size of the legend text, and since the text
> objects are created with RECOMPUTE_DIMENSIONS = 2, the legend should be
> resized every time it is drawn.

> In fact on my system legends do get resized as the size of the destination
> device changes! I wonder why they don't on yours, George. What version are
> you using? Do you have a line that looks like this in the CreateGlyphs
> method in idlgrlegend__define.pro?
>       (*self.pTexts)[index] = OBJ_NEW('IDLgrText', $
>                                       FONT = self.oFont, $
>                                       COLOR = (*self.pText_Color), $
>                                       STRINGS = (*self.pItem_Name)[index],$
>                                       RECOMPUTE_DIMENSIONS = 2)
> If you want to debug this you could put a break in ComputeDimensions and see
> what's happening. (Warning: you may be surprised how often a model's Draw
> method is called.)

I am using 5.4 on NT.
Now that I know it works for someone I'll go and have another look.

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