|
Technical answers from the trenches |
|
Handling Maximized Reports
| ||||
Posted: 21 February 2002 |
||||
  |
Applies to: All versions |
|||
  |
Audience: Beginner |
|||
Question: My users typically maximize reports whn previewing them. When they close the report, though, the form that opened it is still maximized. How do I handle this?Answer: This is a by-product of the way Windows handles child windows in an MDI application. By default, when you maximize any child window, all child windows are maximized until you restore (un-maximize) one. The best way to handle this is to see if the form is maximized when the user is finished with the report. If so, then restore it to its orginal size. The following code shows one way to do this using a report provided with the Paradox sample files: method pushButton(var eventInfo Event)
var
rpt Report
endVar
rpt.open( "customer" )
rpt.wait()
if isMaximized() then
menuAction( menuControlRestore )
endIf
try
rpt.close()
onFail
; do nothing; report is already closed
endTry
endMethodThe above code sample opens the report in a Preview window and then waits for the user to close it. Then, it checks to see if the form is maximized and, if so, triggers the menu action that restores it. MenuControlClose is the same command that's triggered when you choose Restore from a child window's Control menu in Paradox. Thus, we handle the problem by mimicking the actions of the user. In many cases, this is a good way to handle many common tasks in Paradox. The trick, of course, is learning the constants and their actions. For more information, search the ObjectPAL Reference Help file for "menu constants" and then choose the "MenuCommands constants" topic from the Topics Found dialog. This lists the menu command constants and their results. Keep in mind that Paradox provides two appropriate events: menuAction() responds to menu commands and action() handles other activities. If you have trouble implementing it, see if you're doing something like this: action( menuControlRestore ) If so, change action() to menuAction(). |
|||
|
||||||||
|
Copyright © 2000-2004, techtricks.com; All Rights Reserved. Acknowledgements, Disclaimers, Terms and Conditions. |
||||||||
|
Article last updated on 01 June 2003
|
||
|
|
||
|
[- End -]
|