PWCT 1.9 Art Documentation ( http://doublesvsoop.sourceforge.net ) 2006-2019, Mahmoud Fayed ( msfclipper@users.sourceforge.net ) _____________________________________________________________________________________ Table of contents 1 - Introduction 2 - Implementation steps 3 - Final Steps Tree 4 - Application during the runtime 1 - Introduction In this lesson we are going to learn how to create and show Master-Details report. 2 - Implementation Steps Open sysdata.mdb , password = systemdatabase123 Fig. 1 Create new report using the Wizard Fig. 2 Fig. 3 Fig. 4 Fig. 5 Fig. 6 Fig. 7 Fig. 8 Fig. 9 Fig. 10 Fig. 11 Fig. 12 Fig. 13 Fig. 14 Fig. 15 Fig. 16 Fig. 17 Fig. 18 Fig. 19 Fig. 20 Fig. 21 Fig. 22 Fig. 23 Fig. 24 Fig. 25 Fig. 26 Fig. 27 Fig. 28 Fig. 29 Fig. 30 Fig. 31 Fig. 32 Run PWCT, Create new file using (Access report – child class) template Fig. 33 Filename = OrdersReport.SSF Fig. 34 Fig. 35 Classname = OrdersReportClass Fig. 36 Fig. 37 Fig. 38 ReportName = Orders_All Fig. 39 cWindowName = OrdersReportWindow Fig. 41 Press CTRL+R to generate the source code file OrdersReport.PRG Fig. 42 Open Main.SSF Fig. 43 Use the component (Set procedure to ) to include the source code file OrdersReport.PRG Fig. 44 Fig. 45 Fig. 46 Create object OrdersReportObject of Class OrdersReportClass Fig. 47 Fig. 48 Fig. 49 Define menu item to call the report window Fig. 50 Fig. 51 3 - Final Steps Tree ======================= Main.SSF ======================= The First Step Load System Modules Set Procedure to "About.PRG" Set Procedure to "Database.PRG" Set Procedure to "Customers.PRG" Set Procedure to "CustomersBrowse.PRG" Set Procedure to "CustDataBrowse.PRG" Set Procedure to "CustomerBrowse2.PRG" Set Procedure to "ReportParent.PRG" Set Procedure to "CustomersReport.PRG" Set Procedure to "CustomersReport2.PRG" Set Procedure to "MasterDetailsTest.PRG" Set Procedure to "OrdersReport.PRG" Create System Objects Create Object AboutObject of Class AboutClass Create Object CustomersDataObject of Class CustomersDataClass Create Object CustomersBrowseObject of Class CustomersBrowseClass Create Object CustDataBrowseObject of Class CustDataBrowseClass Create Object CustomersBrowse2Object of Class CustomersBrowse2Class Create Object CustomersReportObject of Class CustomersReportClass Create Object CustomersReport2Object of Class CustomersReport2Class Create Object OrdersObject of Class OrdersClass Create Object OrdersReportObject of Class OrdersReportClass Define New Window ( win1 ) , Title : "System" Window Events Window Properties Window Controls START OF MAIN MENU MENU POPUPS DEFINE POPUP "File" POPUP ITEMS Define ITEM ( "Customers Data/Browse" ) Define ITEM ( "Customers Browse" ) Define ITEM ( "Customers Browse by Country" ) Define ITEM ( "Customers" ) Define ITEM ( "Customers Report" ) Define ITEM ( "Customers Report - filter by date of birth" ) Define ITEM ( "Master Details test" ) Define ITEM ( "Master Details report" ) Define ITEM ( "About" ) Define ITEM ( "Close System" ) END OF POPUP END OF MAIN MENU Define New Statusbar Items Define New StatusItem ( "Ready" ) Events Properties Keyboard Events Properties Clock Events Properties End Statusbar End Of Window win1.Maximize ( ) Activate window Procedures Define Procedure closesystem Start Here win1.Release ( ) End of Procedure =========================== OrdersReport.SSF =========================== Set Class Name & Window Name PWCT-Code Generator: Replace String (MyClassName) with (OrdersReportClass) PWCT-Code Generator: Replace String (MyWindowName) with (&(self:cWindowName)) Class Define Class MyClassName From Report_Base Declare Class Data Data ReportName Init Value "Orders_All" Data cWindowName Init Value "OrdersReportWindow" Declare Class Methods Method showwindow Method closewindow Method SizeReport End of Class Class Methods Define Method ShowWindow Class MyClassName Start Here Define New Window ( MyWindowName ) , Title : "Report" Window Events Event: ON INIT : Action self:ShowReport() Event: ON SIZE : Action self:SizeReport() Event: ON MAXIMIZE : Action self:SizeReport() Window Properties Window Controls Define New Button ( btn1 ) , Caption : "Close" Button Events Event: ON CLICK : Action self:CloseWindow() Button Properties Define New Button ( btn2 ) , Caption : "Print" Button Events Event: ON CLICK : Action self:PrintReport() Button Properties Define New Button ( btn3 ) , Caption : "Refresh" Button Events Event: ON CLICK : Action self:ShowReport() Button Properties Active Control ( self:oActiveX ) End Of Window MyWindowName.Maximize ( ) Activate window End of Method (Return 0) Define Method CloseWindow Class MyClassName Start Here MyWindowName.Release ( ) End of Method (Return 0) Define Method SizeReport Class MyClassName Start Here Local tempvar1,tempvar2 tempvar1 = MyWindowName.Width tempvar2 = MyWindowName.Height self:oactivex.nWidth := tempvar1 - 84 self:oactivex.nHeight := tempvar2 - 125 MyWindowName.btn1.Row := tempvar2-88 MyWindowName.btn2.Row := tempvar2-88 MyWindowName.btn3.Row := tempvar2-88 self:oactivex.Show ( ) End of Method (Return 0) 4 - Application during the runtime Fig. 52 Fig. 53
|