Page 2 of 2
Posted: Tue May 01, 2007 4:20 pm
by dave novo
Hi Sergey,
That sounds great then. I realize this may be an advanced issue that not many people will use, but once its there, people could use it for dynamically changing the font attributes in very interesting ways.
Posted: Mon Jun 29, 2009 11:05 pm
by dave novo
Hi Sergey,
We have just upgraded to the newest Richview, and were wondering if you managed to implement this feature in the intervening years.
The last suggestion you came up with, onAfterApplyStyleToCanvas would be a big help for us.
As a reminder, on an item by item basis, we want to be able to use the StyleNo that is part of the item, or provide a new StyleNo. We have to be consistent in terms of printing, editing, viewing etc.
The other alternative you suggested was to have an OnAfterApplyStyleToCanvas, which would also allow us to modify the canvas properties directly for the item.
Were any of those implemented yet?
Posted: Wed Jul 01, 2009 5:08 pm
by Sergey Tkachenko
Ok, this event will be added in the next update.
Posted: Wed Jul 01, 2009 9:30 pm
by dave novo
Hi Sergey,
In the OnAfterApplyStyleToCanavs event, I think that I would need the itemNo, StyleNo, rvData
Maybe it would be easier to have an
OnBeforeApplyStyleToCanvas(itemNo:integer; var StyleNo:integer; rvData:TCustomRvData);;;
That way, I could change the StyleNo before its applied to the canvas....
Another point is that I am unclear how this would work with the labels.
In TRvLabelItem.DoPaint, you have the following code
Code: Select all
RVStyle.ApplyStyle(Canvas, TextStyleNo, rvbdUnspecified,
rvidsCanUseCustomPPI in State, nil, False);
RVStyle.ApplyStyleColor(Canvas,TextStyleNo,TextDrawState, False, ColorMode);
if not (rvidsSelected in State) and
((Style.FieldHighlightType=rvfhAlways) or
((Style.FieldHighlightType=rvfhCurrent) and
([rvidsCurrent,rvidsControlFocused]*State=[rvidsCurrent,rvidsControlFocused]))) then begin
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := Style.FieldHighlightColor;
end;
Would the on(After/Before)ApplyStyleToCanvas be called as part of the ApplyStyle or ApplyStyleColor or both. I guess it would be a bit of work on your part because you have to add an ItemNo parameter to ApplyStyle and ApplyStyleColor which may affect a lot of things.
However, even after that, you are setting the Canvas color on its own. If we change the canvas in OnAfterApplyStyleToCanvas then you will overwrite our change with the Brush Style and Brush Color....
I can see this may be something that is difficult to implement correctly. If this is the case just let me know. I can just copy your TRvLabelItem and make my own with its own OnGetStyleNo event.
Posted: Thu Jul 02, 2009 12:07 pm
by Sergey Tkachenko
Well, as you can see, ApplyTextStyle has only StyleNo parameter, not RVData and ItemNo. Adding them will break compatibility.
Consider changing drawing function in your label.
Posted: Thu Jul 02, 2009 2:13 pm
by dave novo
Sure. No problem. The label drawing is not that complicated....