Re: IDLgrLegend and ENABLE_FORMATTING [message #48944] |
Thu, 08 June 2006 07:39 |
Jim Pendleton, RSI
Messages: 3 Registered: March 2005
|
Junior Member |
|
|
"Jamie Wheeler" <jamiedotwheeleratatmoxacuk@dummy.com> wrote in message
news:Pine.LNX.4.58.0606080406300.14281@ellinga.atm.ox.ac.uk. ..
> Hi all,
>
> I'd like to create a legend using the IDLgrLegend object but I need to be
> able to use subscripts and superscripts in the ITEM_NAMES. From my
> attempts thus far, I gather this is impossible. Please, someone... prove
> me wrong.
>
Here's a perfect instance for subclassing. The IDLgrLegend class does
almost everything you want it to do, but it lacks one small feature.
Don't edit the base class. Instead, create your own class and extend
the method that creates the IDLgrText objects.
Pro YourLegend::CreateGlyphs
Compile_Opt StrictArr
On_Error, 2
;
; Call the superclass method first.
;
self->IDLgrLegend::CreateGlyphs
;
; Now enable formatting on all your text objects.
;
For Index = 0L, N_elements(*self.pItem_Name) - 1 Do Begin
(*self.pTexts)[index]->SetProperty, Enable_Formatting = 1
EndFor
;
; That's it!
;
End
Pro YourLegend__Define
Compile_Opt StrictArr
On_Error, 2
YourLegend = {YourLegend, $
Inherits IDLgrLegend $
}
End
Instead of calling OBJ_NEW('IDLgrLegend'), call OBJ_NEW('YourLegend').
The behavior should be identical except it'll now recognize formatting
commands in your strings.
Jim P.
> Thanks!
> Jamie
|
|
|