Top position notation in report
Jef Leys | Desim
jef.leys at desim.be
Fri Dec 16 15:34:13 UTC 2022
Hi Kelly,
Thx to your tips. I figured it out.
I put about hundred empty field in my report, non-floating, with 0,45cm as height.
For the top position I had this method getLineAndOffset:
Calculate Line as int(pTop/0.45)
Calculate prOffset as pTop-(Line*0.45)
Calculate prLineNo as Line+1
After adding an object and getting the ref rObject
Do rObject.$floating.$assign(kTrue)
Do method getLineAndOffset (ExtraVertical+ExtraPagEnd,LineNo,Offset)
Do rObject.$lineno.$assign(LineNo)
Do rObject.$lineoffset.$assign(Offset)
To avoid rectangles over the bottom of the page I added the following in each loop,
Calculate ExtraPagEnd as ExtraPagEnd+((int((ExtraVertical+rContentLine.LabelTotalHeight+ExtraPagEnd)/PagHeight)-int((ExtraVertical+ExtraPagEnd)/PagHeight))*(mod(ExtraVertical+ExtraPagEnd+rContentLine.LabelTotalHeight,PagHeight)+0.1-rContentLine.LabelTotalHeight))
Where PagHeight=$cinst.$paperlength-$cinst.$bottommargin-$cinst.$topmargin
Works like a charm.
Jef
> Op 10 dec. 2022, om 02:35 heeft Kelly Burgess <kellyb at montana.com> het volgende geschreven:
>
> Hi Jef,
>
>> I do this in the construct of that report.
>>
>> Do $cinst.$objs.$add(kRect,(0+ExtraVertical),0,rContentLine.LabelHeight,rContentLine.LabelWidth) Returns rObject
>> . . .
>> . . .
>> The problem is the vertical positioning
>
>
> I've struggled with this and I don't have a complete answer yet... But the main thing is that when you $add() objects to a window or report class, the iTop parameter is expressed in pixels, but for a report it should be expressed in *lines* instead. The difficult part is mapping the pixel offsets to line numbers. Report lines do not have a fixed pixel height, it can vary from line to line.
>
> According to engineering, Omnis builds an array of lines from the objects in the report that are not marked as floating, and the height of each line is the largest height of a non-floating object on the line.
>
> Suggestions have included
>
> - using the reference returned by $add to set the $lineno of the object
> - setting the $floating property to kTrue, which then allows you to set $lineoffset
> - adding invisible non-floating objects to exert control over line heights
>
> I think you want to come up with that array of line heights. Then you should be able to map a vertical pixel position to a known line number, use that line number in the $add(), then if needed set $floating kTrue and fiddle with the $lineoffset to arrive at the precise ultimate position.
>
> Note that properties like $lineno and $lineoffset don't appear in the Property Manager when you select a report object in design mode by clicking it in the class design window, but if you use the Notation Inspector's search tool to click on it, then you'll see the larger set of properties.
>
> Kelly
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list