trichview.com

trichview.support




Re: is there an item.onTextStyleChanged ?


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/01/2004 11:43:31


The best way to add your own text data in item's RVF without rewritting

ancestor's SaveRVF method is defining your custom properties.

There are 3 kinds of item properties in RVF:

1) integer (fixed set of properties),

2) string (fixed set of properties),

3) string properties (your own)

You can expand (3)


- Override GetRVFExtraPropertyCount. Return inherited + count of your own

properties to save

- Override SaveRVFExtraProperties; Call inherited, then save your own

properties. Each property must be saved as a line "propertyname=value"

- Override SetExtraCustomProperty. This method is called when a property

(not belonging to the standard property set) is read from RVF.


Note: it's recommended to save only properties having nondefault values.

GetRVFExtraPropertyCount must return a number of properties that actually

will be saved (i.e. having nondefault values).


Note: (2) and (3) are only for new version of TRichView (available for

registered users)



> Thanks for the ideas Sergey.  We're working now with our own descendent

> of the LabelItem, and it takes care of a lot of the workarounds we had

> to do before.

>

> We're running into a confusing situation, though, with regards to

> streaming.  In the method TRVLabelItemInfo.saveRVF, it first saves

> header information, along with a hard-coded number of additional

> properties, and then the additional properties.

>

> What is the best way for us to plug into this system, and save our own

> descendent's additional properties?

>

> We would prefer to be able to call inherited TRVLabelItemInfo.saveRVF,

> and not modify the code in that method.  Is there a way to do this?

>

> Thanks,

> Daniel

>

>

>

> "Sergey Tkachenko" <[email protected]> wrote in

> news:[email protected]:

>

> > Applying text style to text items and non-text items is performed in

> > different ways.

> > While RichViewEdit changes a style of text items directly, for

> > non-text items it calls a special item method allowing them to respond

> > on style applying.

> > There is one more important difference between text and non-text

> > items. For text item, style applying changes their style (StyleNo item

> > property). For non-text item, item style must *not* be changed.

> > StyleNo of non-text item is not an index in the collection of text

> > styles, it's a constant identifying item type.

> >

> > May be it would be better to take the example from

> > Demos\Addins\LabelItem\ as a base for your item. It may be not

> > necessary to create a control - item can draw itself onto canvas and

> > respond on mouse events. Even if you still need a control, you can

> > look how LabelItem works with the associated text style.

> >

> > Note: there were some changes in the latest version of TRichView

> > (available for registered users), so LabelItem was updated.

> > Specifically, changes are related to style applying.

> >

> >> Hi Sergey,

> >>

> >> What we are trying to do is this:

> >>

> >> We are trying to embed a delphi control in trichview. This is

> >> obviously easy. In our case, the control actually represents a

> >> different, non-visual, aspect of our program to the user.  Therefore

> >> the control has text (representing the name and/or value of the

> >> non-visual part). We are trying to keep the font of the text in the

> >> control the same as what it should be. i.e. if the user selects

> >> several items that includes the control, and changes the font on the

> >> selection, the font on the control should change appropriately.

> >>

> >> We have followed the example in the \demos\addins\chartItem to create

> >> a new item. We have modified the print routine so our controlItem

> >> prints properly. That works wonderfully.

> >>

> >> When streaming out, we don't want to save the control (as happens in

> >> default saveToRVF), because we want to keep the possibility of

> >> changing the type of this control in future versions of our product.

> >> We want to stream out the controlItem, without the control, and when

> >> we stream the item back in, dynamically create the appropriate

> >> control.

> >>

> >> So, we now want to store the style number, so that when we stream in

> >> our new item, we can reapply that style to the control. Now, I am

> >> still relatively new to trichview, but it seems that the styleNum

> >> property of an item is overloaded for different purposes.  One is the

> >> item type (i.e. text, component, bullet, table), and the other is a

> >> font style number. It would be easier if these were two different

> >> properties, so that a controlItem could have a font style, for

> >> instance.

> >>

> >> What is the easiest way to do what we need with trichview. We want to

> >> be able to create a descendant of the control item and remember what

> >> font style it had. I ordered your software but have not received the

> >> source yet. Is there a setStyle for the controlItem I can override to

> >> store the style number, even though it seems I have to make my style

> >> return -12345 or something. How do I let richview know that this

> >> style is being used by my item.

> >>

> >> I know this is complex so I really thank you for your help in this

> >> matter.

> >>

> >> -Dave

> >>

> >>

> >> Sergey Tkachenko wrote:

> >>

> >> > Currently no function/event is called on changing text style of

> >> > item. Can you explain why it's needed?

> >> > May be I'll add this functionality.

> >> >

> >> > > I would like to execute some code when an item changes text

> >> > > style. Is there a way to trap this?  Preferably through an event,

> >> > > but if need be we could override a setStyle-type method in our

> >> > > own *ItemInfo descendent.

> >>

> >

> >

>





Powered by ABC Amber Outlook Express Converter