AW: O$: assign $top to a report text object

Rudolf Bargholz rudolf at bargholz.ch
Thu Jul 24 10:09:13 EDT 2014


Hi Jim,

This has something to do with which report coordinate system you are using. You can't just change the $top without specifying which coordinates you are referring to.

I wrote a demo library many, many .... many years ago trying to get a handle on the coordinate systems for reports, and I think Geir or David Swain had did demos on this at an Omnis Undergroud conference. My demo can be found here:

http://www.tigerlogic.com/tigerlogic/omnis/technotes/tnpr0007.jsp

I do not in any way attempt to infer I know what I am talking about here :-) This was and probably still is way above my head.

I would take the code out of the $construct and overwrite the $print of the section enclosing your text object with the following:

Calculate lrPosition as pfPosition
Calculate lcData as pfData
;  Note: prPosition is a row variable(field reference) and contains global coordinates at this point.
;  Copy prPosition into a row variable and convert it to page-based coordinates.
Calculate lrPosition.$posmode as kPosSection
;  Fetch the global boundaries for this page. We can do this  now since setting
;  $posmode to kPosLocal set $poshorzpage and $posvertpage
Calculate lrPosition.$posmode as kBndsGlobal

;  dynamically change the data to be printed in this field
;  Calculate pfData as con(ilList.$line,pfData)
Calculate lrPosition.$top as 1
Calculate lrPosition.$left as 2
Do $cinst.$objs.1013.$print(lrPosition)
Do default 
Quit method 

;  pfPosition passes a field reference to the position of this object.
;  lrPosition has the following column definition
;  
;  $inst - the report instance
;  $posmode - the current objects report position mode
;  $possecident - the $ident of of the section when $posmode is kPosSection
;  $posvertpage - the vertical page number when $posmode IS NOT kPosGlobal or kPosSection
;  $poshorzpage - the horizontal page number when $posmode IS NOT kPosGlobal or kPosSection
;  $top - the top of the position local to it's $posmode
;  $left - the left of the position local to it's $posmode
;  $width - the width of the position local to it's $posmode
;  $height - the height of the position local to it's $posmode

;  pfData passes a field reference that holds the data to be displayed.
;  Editing this value will edit the displayed data

The code above is untested, and you will have to experiment to get this working. A few things to keep in mind:

1) $top is always relative to the positioning section/section in which the object is contained.
2) Even a background-object in a report can have a $print, so you can send position information to a report background object via the structure above.

On a side note to (2) above: you can even dynamically, using notation, write code behind a report background objects. We are currently experimenting with writing a tool that appends to each object in a report code in order to write HTML, that contains only <div> elements as well as style name elements that we can then style using a customer specific CSS to get decent HTML output of reports in Studio. Each positioning section is a div, each element a div.

Hope this helps.

Regards

Rudolf

-----Ursprüngliche Nachricht-----
Von: omnisdev-en-bounces at lists.omnis-dev.com [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im Auftrag von Jim Pistrang
Gesendet: Donnerstag, 24. Juli 2014 15:26
An: Omnis List Mail
Betreff: O$: assign $top to a report text object

Hi all,

I am working with a TEXT object in the header section of a report.  I am able to $assign the $left property of the object in the $construct of the report.  However, when I try to assign the $top property the object disappears.  Am I doing something wrong?  Is this a bug?  A feature?

My code:

this works:  Do $cinst.$objs.1013.$left.$assign(1)

this does not work:  Do $cinst.$objs.1013.$top.$assign(1)

Thanks,

Jim

-- 
Jim Pistrang
JP Computer Resources
413-256-4569
<http://www.jpcr.com>


_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com



More information about the omnisdev-en mailing list