WIN: Interactive reports from ObjectPAL 
Author Message
 WIN: Interactive reports from ObjectPAL

In response to requests for details on ObjectPAL control of
a) report modification, and b) interactive paging, herewith scraps of
my current report library code.

Prior requirements:

1. A report (in this case called PRINTSUM.RSL) which has ALL the
fields that might be required, from which user selections will
determine what is ACTUALLY used for each print run.

2. A control table of some kind which has the current user selections
for what should/should not be on the report this time around. Have the
reptc Tcursor used below open on the record with the selections for
the current report...

3. When first starting my application, I run hidespeedbar() as we
won't be needing it...

4. A *tiny* form, SCROLLER, which has six buttons -- "Done", "Print"
plus four arrows: "First", "Prev", "Next", "Last". All each of these
buttons has to do when pushed is formReturn( The smaller
the form, the better, as it appears over the top of the report -- but
I do tend to keep the title bar as it allows it to be shifted around
so the user can see what's under it! Also, as a convenience, the Print
button has a MouseRightDown action of menuaction(MenuFilePrinterSetup).

So, assuming your reptc is all set, away we go:

; Displays the PRINTSUM report with a scroller form.
; All DB files are assumed ready to go, as are defaults
; controlled by reptc.
method do_display(const reptc Tcursor) Logical
   printsumRep Report
   scroller Form
   operation String
   counter SmallInt
   if not printSumRep.load(":MMR:PRINTSUM") then
      msgStop("Sorry","Could not load PRINTSUM.RSL to implement user selections")
      return False

   if not prune_PrintSum(printSumRep,reptc) then; implement user selections
      return False

; At this point, what we've done is removed unnecessary/unwanted
; fields from PRINTSUM.RSL -- we now
; want to display what's left.

; But first, we MUST save the modifications as otherwise
; when we close PRINTSUM later, the user will see an unavoidable
; "Changes Have been made -- save 'em?" dialog box":MMR:DUMMY")   ; just save changes, don't need 'em!

   if not":MMR:SCROLLER") then
      msgStop("Display","Could not open display speedbar!")
      return False
   endif   ; show us what you've got...

   ; Away we go...

   while True   ; show our mini scroller form
      operation = scroller.wait()   ; get response
      scroller.hide()   ; get rid 'o the form
         case operation = "Done":
         case operation = "Print":
            printSumRep.print()   ; run the lot
            quitloop      ; and exit
         case operation = "First":
         case operation = "Last":
            counter = printSumRep.currentPage()
            while counter = printSumRep.currentPage() ; eventually, we overtake it
               counter = counter + 1
               printSumRep.moveToPage(counter) ; yuk      
            endwhile      ; if there's a better way, I want to know
         case operation = "Prev":
            printSumRep.moveToPage(printSumRep.currentPage()-1) ; handles <1 sensibly
         case operation = "Next":
            printSumRep.moveToPage(printSumRep.currentPage()+1) ; handles >max sensibly
   endwhile   ; all done

   printSumRep.close()   ; and that's it for the scrolling
   return True

; Modifies printSum.RSL report according to the
; user selections in the record addressed by reptc
; Leaves printSumRep ready to run()
; Returns False in case of error
; ** My working routine has about a dozen selections. I've
; left one in as a representative idea of how to do it.

method prune_PrintSum(const printSumRep Report, const reptc Tcursor) Logical
   if reptc."Page Break"<>"Y" then
      if not prune_object(printSumRep,"#PageBreak48") then
         return False
   return True

; Attaches to specified object on PrintSumRep
; and deletes
; Returns false if attach fails
method prune_Object(const printSumRep Report, const name String) Logical
   object UIObject

   if not object.attach(printSumRep.(name)) then
      msgStop("prune_object","Could not remove object "+name+" from PrintSum")
      return False
   object.delete()   ; the point of the exercise
   return True

A lot of code to absorb, and already being extended in some areas, but
I hope you have enough to implement the gist of these ObjectPAL
controls should you need 'em. Please let me know if you come up with


             Peter Hyde, South Pacific Information Services Ltd
             New Zealand -- life on the outer edge of the planet

Thu, 04 Jul 1996 06:35:21 GMT
 [ 1 post ] 

 Relevant Pages 

1. WIN: Interactive Reports

2. Interactive Queries Invoked From ObjectPal

3. Interactive Queries Invoked From ObjectPal

4. Pdox 5 Interactive QBE in Win 3.1

5. Interactive Queries in Paradox 7.0 Win 95

6. PDOX 4.5 WIN - ObjectPal Spreadsheet Export Error

7. Pdox 4.5 Win ObjectPAL help!

8. Deleting files in ObjectPal in Win 95

9. PDOX/WIN Including calculated fields in a ObjectPal Query

10. WIN: ObjectPAL Query + Keywords (Repost)

11. Printing Forms in Win Pdox from ObjectPAL

12. WIN: ObjectPal query + keywords

Powered by phpBB® Forum Software