Fast Track To Powerbuilder Part 1 Labworkbook v1
Fast Track To Powerbuilder Part 1 Labworkbook v1
Fast Track To Powerbuilder Part 1 Labworkbook v1
Lab WorkBook
Lab WorkBook
Version 1.0
Part # DEV134-90-1200-10
Version 1.0
Part # DEV134-90-1200-10
Notice
Notice
No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic,
mechanical, manual, optical or otherwise, without prior written permission from Sybase, Inc.
No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic,
mechanical, manual, optical or otherwise, without prior written permission from Sybase, Inc.
Sybase Trademarks
Sybase Trademarks
Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive
Server, Adaptive Server Anywhere, Adaptive Server Enterprise, Adaptive Warehouse, AnswerBase, Application Manager,
AppModeler, APT Workbench, APT-Build, APT-Edit, APT-Execute, APT-FORMS, APT-Translator, APT-Library, ASEP,
Backup Server, BayCam, Bit-Wise, Certified PowerBuilder Professional, Certified SYBASE Professional, Certified SYBASE
Professional Logo, ClearConnect, Client-Library, Client Services, CodeBank, Column Design, ComponentPack, Connection
Manager, CSP, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DBLibrary, dbQueue, Developers Workbench, DirectConnect, Distribution Agent, Distribution Director, Dynamo, Electronic Case
Management, Embedded SQL, EMS, Enterprise Client/Server, Enterprise Connect, Enterprise Manager, Enterprise SQL Server
Manager, Enterprise Work Architecture, Enterprise Work Designer, Enterprise Work Modeler, EWA, First Impression, Formula
One, Gateway Manager, GeoPoint, IDN, ImpactNow, InfoMaker, InformationConnect, InstaHelp, Internet Developers Network,
InternetBuilder, iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager, MainframeConnect,
Maintenance Express, MAP, MDI Access Server, MDI Database Gateway, media.splash, MetaWorks, MethodSet, Net-Gateway,
Net-Library, NetImpact, O DEVICE, OASiS, OASiS logo, ObjectConnect, ObjectCycle, OmniConnect, OmniSQL Access
Module, OmniSQL Toolkit, Open Client, Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open
Gateway, Open Server, Open ServerConnect, Open Solutions, Optima++, Partnerships that Work, PB-Gen, PC APT Execute, PC
DB-Net, PC Net Library, Power ++, Power J, Power Through Knowledge, power.stop, PowerAMC, PowerBuilder, PowerBuilder
Foundation Class Library, PowerBuilt, PowerBuilt with PowerBuilder, PowerDesigner, PowerScript, PowerSite, PowerSocket,
Powersoft, PowerStudio, PowerTips, Powersoft Portfolio, Powersoft Professional, PowerWare Desktop, PowerWare Enterprise,
ProcessAnalyst, QuickStart DataMart, QuickStart MediaMart, QuickStart ReportSmart, Report Workbench, Report-Execute,
Replication Agent, Replication Driver, Replication Server, Replication Server Manager, Replication Toolkit, Resource Manager,
RW-DisplayLib, RW-Library, S Designor, S-Designor, SAFE, SAFE/PRO, SDF, Secure SQL Server, Secure SQL Toolset,
Security Guardian, SKILS, smart.partners, smart.parts, smart.script, SQL Advantage, SQL Code Checker, SQL Debug, SQL
Edit/TPU, SQL Edit, SQL Modeler, SQL Remote, SQL Server, SQL Server Manager, SQL Server Monitor, SQL SMART, SQL
Toolset, SQL Server/CFT, SQL Server/DBM, SQL Server SNMP SubAgent, SQL Solutions, SQL Station, STEP, SupportPlus,
Sybase Central, Sybase Client/Server Interfaces, Sybase Development Framework, Sybase Gateways, Sybase IQ, Sybase MPP,
Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase Synergy Program, Sybase Virtual Server
Architecture, Sybase User Workbench, SybaseWare, SyBooks, System 10, System 11, System XI (logo), SystemTools, Tabular
Data Stream, The Enterprise Client/Server Company, The Extensible Software Platform, The Future Is Wide Open, The Learning
Connection, The Model For Client/Server Solutions, The Online Information Center, Transact-SQL, Translation Toolkit, Turning
Imagination Into Reality, UNIBOM, Unilib, Uninull, Unisep, Unistring, Viewer, Visual Components, VisualSpeller,
VisualWriter, VQL, WarehouseArchitect, Warehouse WORKS, Watcom, Watcom SQL, Watcom SQL Server, Web.PB,
Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library and XA-Server are trademarks of Sybase, Inc. or its
subsidiaries.
Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive
Server, Adaptive Server Anywhere, Adaptive Server Enterprise, Adaptive Warehouse, AnswerBase, Application Manager,
AppModeler, APT Workbench, APT-Build, APT-Edit, APT-Execute, APT-FORMS, APT-Translator, APT-Library, ASEP,
Backup Server, BayCam, Bit-Wise, Certified PowerBuilder Professional, Certified SYBASE Professional, Certified SYBASE
Professional Logo, ClearConnect, Client-Library, Client Services, CodeBank, Column Design, ComponentPack, Connection
Manager, CSP, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DBLibrary, dbQueue, Developers Workbench, DirectConnect, Distribution Agent, Distribution Director, Dynamo, Electronic Case
Management, Embedded SQL, EMS, Enterprise Client/Server, Enterprise Connect, Enterprise Manager, Enterprise SQL Server
Manager, Enterprise Work Architecture, Enterprise Work Designer, Enterprise Work Modeler, EWA, First Impression, Formula
One, Gateway Manager, GeoPoint, IDN, ImpactNow, InfoMaker, InformationConnect, InstaHelp, Internet Developers Network,
InternetBuilder, iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager, MainframeConnect,
Maintenance Express, MAP, MDI Access Server, MDI Database Gateway, media.splash, MetaWorks, MethodSet, Net-Gateway,
Net-Library, NetImpact, O DEVICE, OASiS, OASiS logo, ObjectConnect, ObjectCycle, OmniConnect, OmniSQL Access
Module, OmniSQL Toolkit, Open Client, Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open
Gateway, Open Server, Open ServerConnect, Open Solutions, Optima++, Partnerships that Work, PB-Gen, PC APT Execute, PC
DB-Net, PC Net Library, Power ++, Power J, Power Through Knowledge, power.stop, PowerAMC, PowerBuilder, PowerBuilder
Foundation Class Library, PowerBuilt, PowerBuilt with PowerBuilder, PowerDesigner, PowerScript, PowerSite, PowerSocket,
Powersoft, PowerStudio, PowerTips, Powersoft Portfolio, Powersoft Professional, PowerWare Desktop, PowerWare Enterprise,
ProcessAnalyst, QuickStart DataMart, QuickStart MediaMart, QuickStart ReportSmart, Report Workbench, Report-Execute,
Replication Agent, Replication Driver, Replication Server, Replication Server Manager, Replication Toolkit, Resource Manager,
RW-DisplayLib, RW-Library, S Designor, S-Designor, SAFE, SAFE/PRO, SDF, Secure SQL Server, Secure SQL Toolset,
Security Guardian, SKILS, smart.partners, smart.parts, smart.script, SQL Advantage, SQL Code Checker, SQL Debug, SQL
Edit/TPU, SQL Edit, SQL Modeler, SQL Remote, SQL Server, SQL Server Manager, SQL Server Monitor, SQL SMART, SQL
Toolset, SQL Server/CFT, SQL Server/DBM, SQL Server SNMP SubAgent, SQL Solutions, SQL Station, STEP, SupportPlus,
Sybase Central, Sybase Client/Server Interfaces, Sybase Development Framework, Sybase Gateways, Sybase IQ, Sybase MPP,
Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase Synergy Program, Sybase Virtual Server
Architecture, Sybase User Workbench, SybaseWare, SyBooks, System 10, System 11, System XI (logo), SystemTools, Tabular
Data Stream, The Enterprise Client/Server Company, The Extensible Software Platform, The Future Is Wide Open, The Learning
Connection, The Model For Client/Server Solutions, The Online Information Center, Transact-SQL, Translation Toolkit, Turning
Imagination Into Reality, UNIBOM, Unilib, Uninull, Unisep, Unistring, Viewer, Visual Components, VisualSpeller,
VisualWriter, VQL, WarehouseArchitect, Warehouse WORKS, Watcom, Watcom SQL, Watcom SQL Server, Web.PB,
Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library and XA-Server are trademarks of Sybase, Inc. or its
subsidiaries.
All other company and product names used herein may be the trademarks or registered trademarks of their
respective companies.
All other company and product names used herein may be the trademarks or registered trademarks of their
respective companies.
Use, duplication or disclosure by the Government is subject to restrictions set forth in subparagraph (c)(1)(ii) of
DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)(d) for civilian agencies.
Use, duplication or disclosure by the Government is subject to restrictions set forth in subparagraph (c)(1)(ii) of
DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)(d) for civilian agencies.
TOC - 1
TOC - 1
Lab Workbook
Lab Workbook
Lab 13-1: Creating and Using Standard Class User Objects ......................................................Lab 13-1
Detailed Instructions ....................................................................................................................Lab 13-2
Lab 13-2: Creating and Using Custom Class User Objects ........................................................Lab 13-14
Lab 13-1: Creating and Using Standard Class User Objects ......................................................Lab 13-1
Detailed Instructions ....................................................................................................................Lab 13-2
Lab 13-2: Creating and Using Custom Class User Objects ........................................................Lab 13-14
TOC-3
TOC-3
Lab Workbook
TOC - 4
Lab Workbook
TOC - 4
Objectives:
Objectives:
Install the files from the accompanying CD-ROM, which are necessary to complete the
labs for this course.
Install the files from the accompanying CD-ROM, which are necessary to complete the
labs for this course.
Familiarize yourself with the final solution so that you will better understand the
application you will be building.
Familiarize yourself with the final solution so that you will better understand the
application you will be building.
Description:
In this lab, you will install the files from the CD-ROM that accompanied your Student
Guide. You will become familiar with the directory structure created from the install,
learning where you will store application components that you create as well as understand
the purpose of the other lab folders. After installing the student files, you will run the final
solution (executables) so that you have an idea of what you will be building over the next
five days.
Description:
In this lab, you will install the files from the CD-ROM that accompanied your Student
Guide. You will become familiar with the directory structure created from the install,
learning where you will store application components that you create as well as understand
the purpose of the other lab folders. After installing the student files, you will run the final
solution (executables) so that you have an idea of what you will be building over the next
five days.
Task Outline:
Task Outline:
Lab 1 - 1
Lab 1 - 1
Detailed Instructions
Detailed Instructions
Lab 1 - 2
1.
Insert the provided CD-ROM into your machine and open Windows Explorer.
1.
Insert the provided CD-ROM into your machine and open Windows Explorer.
2.
In Windows Explorer, navigate to your CD drive. You will see a file in the root
directory on the CD named Setup.exe. Double-click this file.
2.
In Windows Explorer, navigate to your CD drive. You will see a file in the root
directory on the CD named Setup.exe. Double-click this file.
3.
3.
4.
4.
5.
5.
6.
6.
7.
7.
8.
Under the C:\ drive you will see a folder named Sybase Courses. Under that is folder
named DEV134 (the course code for FastTrack to PowerBuilder, Part I). Below
DEV134 are a series of folders. Review the contents of those folders:
8.
Under the C:\ drive you will see a folder named Sybase Courses. Under that is folder
named DEV134 (the course code for FastTrack to PowerBuilder, Part I). Below
DEV134 are a series of folders. Review the contents of those folders:
9.
The course uses Sybases SQL Anywhere database (Version 11). The Database
folder contains a SQL Anywhere database named SybHealth.db. There is also a file
named SybHealthDDL.sql if you need to create the database / tables on an older
version of SQL Anywhere. A Developers edition of SQL Anywhere 11 can be
installed from your original PowerBuilder installation CD if you do not already have
it on your machine.
9.
The course uses Sybases SQL Anywhere database (Version 11). The Database
folder contains a SQL Anywhere database named SybHealth.db. There is also a file
named SybHealthDDL.sql if you need to create the database / tables on an older
version of SQL Anywhere. A Developers edition of SQL Anywhere 11 can be
installed from your original PowerBuilder installation CD if you do not already have
it on your machine.
10. The Demo Applications will be discussed during the class and will be good for you to
review afterwards.
10. The Demo Applications will be discussed during the class and will be good for you to
review afterwards.
11. There are coded solutions for every lab. If you are doing labs and reach an impasse,
use the solutions as your guide. Module 2 will teach you how to add one of the
solutions (a Target) to your PowerBuilder Workspace.
11. There are coded solutions for every lab. If you are doing labs and reach an impasse,
use the solutions as your guide. Module 2 will teach you how to add one of the
solutions (a Target) to your PowerBuilder Workspace.
Lab 1 - 2
12. The class and labs will be performed on PowerBuilder 12 Classic. The objects and
code you write and store into PowerBuilder 12 libraries is not backward compatible to
older versions of PowerBuilder. However, final coded solutions for PowerBuilder 9
are available in the Solutions folder. If you are using PowerBuilder 10 through 11.5
at your worksite, you can easily migrate the PowerBuilder 9 solution to your version.
12. The class and labs will be performed on PowerBuilder 12 Classic. The objects and
code you write and store into PowerBuilder 12 libraries is not backward compatible to
older versions of PowerBuilder. However, final coded solutions for PowerBuilder 9
are available in the Solutions folder. If you are using PowerBuilder 10 through 11.5
at your worksite, you can easily migrate the PowerBuilder 9 solution to your version.
13. The Student folder is where anything you create or save is to be placed. This is your
working directory.
13. The Student folder is where anything you create or save is to be placed. This is your
working directory.
Lab 1 - 3
Lab 1 - 3
Lab 1 - 4
1.
1.
2.
2.
3.
3.
4.
Scroll down and select SQL Anywhere 11 on the Create New Data Source dialog.
4.
Scroll down and select SQL Anywhere 11 on the Create New Data Source dialog.
5.
Click Finish.
5.
Click Finish.
6.
On the ODBC Configuration dialog, the ODBC tab, enter SybHealth as the Data
source name.
6.
On the ODBC Configuration dialog, the ODBC tab, enter SybHealth as the Data
source name.
Lab 1 - 4
7.
On the Login tab, enter sybinsure for both the User ID and Password:
7.
On the Login tab, enter sybinsure for both the User ID and Password:
8.
On the Database tab, click the Browse button, navigating to and selecting the
sybhealth.db in the C:\Sybase Courses\DEV134\Database folder:
8.
On the Database tab, click the Browse button, navigating to and selecting the
sybhealth.db in the C:\Sybase Courses\DEV134\Database folder:
Lab 1 - 5
Lab 1 - 5
Return to the ODBC tab and click the Test Connection button. You should receive a
Connection Successful message:
9.
10. Click OK to close the Note dialog, OK again to close the ODBC Configuration
dialog, and OK one more time to close the ODBC Data Source Administrator dialog.
10. Click OK to close the Note dialog, OK again to close the ODBC Configuration
dialog, and OK one more time to close the ODBC Data Source Administrator dialog.
Lab 1 - 6
Return to the ODBC tab and click the Test Connection button. You should receive a
Connection Successful message:
13. A login window will appear on top of the MDI frame window. For your convenience,
the User Name and Password (both are sybinsure) have been hard-coded.
13. A login window will appear on top of the MDI frame window. For your convenience,
the User Name and Password (both are sybinsure) have been hard-coded.
14. Click on the Change Database picture button on the login window to observe what
happens. Do not change the database name. It should already contain SybHealth, as
that value is read from an INI file.
14. Click on the Change Database picture button on the login window to observe what
happens. Do not change the database name. It should already contain SybHealth, as
that value is read from an INI file.
16. After logging in, the MDI Frame window will appear on top of which is a menu.
Click FileNewClaims. Enter a claim for a patient of your choosing. All fields
are required. Click the red X in the upper right of the window to close and save your
changes.
16. After logging in, the MDI Frame window will appear on top of which is a menu.
Click FileNewClaims. Enter a claim for a patient of your choosing. All fields
are required. Click the red X in the upper right of the window to close and save your
changes.
Lab 1 - 6
18. On the main menu, click FileOpenDoctors (or you can click the first icon on the
toolbar). Experiment. Not all of the icons on the 2nd toolbar are active for the
application. The Print icon is active, however there is no printer available in the
classroom. Attempt to delete Doctor # 1047 (Coleman Bertrand). Are you
successful? Why or why not? Click the Export icon and save your doctor list as an
Excel8 spreadsheet. Be sure to save everything in your Student folder. Close the
Doctor Directory window.
18. On the main menu, click FileOpenDoctors (or you can click the first icon on the
toolbar). Experiment. Not all of the icons on the 2nd toolbar are active for the
application. The Print icon is active, however there is no printer available in the
classroom. Attempt to delete Doctor # 1047 (Coleman Bertrand). Are you
successful? Why or why not? Click the Export icon and save your doctor list as an
Excel8 spreadsheet. Be sure to save everything in your Student folder. Close the
Doctor Directory window.
19. Click FileOpenClaims Search. Click on the ellipse button to the right of the
Patient ID field. Double-click any patient that appears on the Patient Search dialog.
The Patient Search dialog closes and pastes the patient ID in the search window for
you. You can then click the Search button. As you see claims, note that you can drag
and re-order columns in the grid display. You can also double-click on a claim which
will display a modal dialog window showing the details of that claim. Edit a claim
and close the modal window, saving changes. You will notice that the claim search
grid does not update, but if you click the Search button a second time you will see the
results of your change. An automatic refresh is a feature you can add when you
perform the labs to create this window. When finished, close the Claims Search
window.
19. Click FileOpenClaims Search. Click on the ellipse button to the right of the
Patient ID field. Double-click any patient that appears on the Patient Search dialog.
The Patient Search dialog closes and pastes the patient ID in the search window for
you. You can then click the Search button. As you see claims, note that you can drag
and re-order columns in the grid display. You can also double-click on a claim which
will display a modal dialog window showing the details of that claim. Edit a claim
and close the modal window, saving changes. You will notice that the claim search
grid does not update, but if you click the Search button a second time you will see the
results of your change. An automatic refresh is a feature you can add when you
perform the labs to create this window. When finished, close the Claims Search
window.
20. Next click FileOpenPatient Details. This is a master-detail window. Select any
patient in the top (tabular) display, and you will see the bottom (free-form) display
update showing the details of the patient chosen. In the top (tabular) display, you may
click on a column header like First Name. You should see that the data is now sorted
by first name. Click the same header again and the sort changes to a descending sort.
For the Patient Details window, the Sort and Filter icons (2nd toolbar) are active.
Click the Sort icon. Drag first_name away from the Columns listbox, and then drag
state_code from Source Data to Columns. Click OK and note the new sort order.
Click the Filter icon on the toolbar. In the Filter dialog, type the expression:
state_code = TX and click OK. The display should filter out every patient but those
located in Texas. Click the Filter icon again. Clear the expression and click OK. All
patients are returned to the display. Leave the Patient Details window open.
20. Next click FileOpenPatient Details. This is a master-detail window. Select any
patient in the top (tabular) display, and you will see the bottom (free-form) display
update showing the details of the patient chosen. In the top (tabular) display, you may
click on a column header like First Name. You should see that the data is now sorted
by first name. Click the same header again and the sort changes to a descending sort.
For the Patient Details window, the Sort and Filter icons (2nd toolbar) are active.
Click the Sort icon. Drag first_name away from the Columns listbox, and then drag
state_code from Source Data to Columns. Click OK and note the new sort order.
Click the Filter icon on the toolbar. In the Filter dialog, type the expression:
state_code = TX and click OK. The display should filter out every patient but those
located in Texas. Click the Filter icon again. Clear the expression and click OK. All
patients are returned to the display. Leave the Patient Details window open.
21. Click FileOpenDoctor List. You can have as many sheet windows opened within
the MDI frame as you want. You now have multiple sheets open though you can see
only one. On the keyboard press CtrlTab to cycle through the two sheets (Doctor
List and Patient Details). Using the menu, click WindowTile Horizontal. You
should now see the two windows split equally on the screen. Again on the menu,
click WindowLayer. You are back in full-screen mode. Also note that the Window
menu item contains a list of open sheets that you can use to navigate between the two
opened windows.
21. Click FileOpenDoctor List. You can have as many sheet windows opened within
the MDI frame as you want. You now have multiple sheets open though you can see
only one. On the keyboard press CtrlTab to cycle through the two sheets (Doctor
List and Patient Details). Using the menu, click WindowTile Horizontal. You
should now see the two windows split equally on the screen. Again on the menu,
click WindowLayer. You are back in full-screen mode. Also note that the Window
menu item contains a list of open sheets that you can use to navigate between the two
opened windows.
22. With one of the sheets open, go to the menu and click ToolsClaim Calculator. Test
this window by using multiple scenarios. Also, notice the Title Bar of this Claim
Calculator window. It is displaying the name of the user that is logged into the
Windows operating system. This is done by coding external function calls, a feature
you will be taught in the course. Close the Claim Calculator window.
22. With one of the sheets open, go to the menu and click ToolsClaim Calculator. Test
this window by using multiple scenarios. Also, notice the Title Bar of this Claim
Calculator window. It is displaying the name of the user that is logged into the
Windows operating system. This is done by coding external function calls, a feature
you will be taught in the course. Close the Claim Calculator window.
23. While you still have a sheet open experiment with the menu item ToolsToolbars
and the window that appears following that command. When satisfied, close the
Toolbars window.
23. While you still have a sheet open experiment with the menu item ToolsToolbars
and the window that appears following that command. When satisfied, close the
Toolbars window.
24. Click WindowClose All. This closes all of the opened sheet windows but leaves
the MDI Frame window open.
24. Click WindowClose All. This closes all of the opened sheet windows but leaves
the MDI Frame window open.
Lab 1 - 7
Lab 1 - 7
Lab 1 - 8
25. Click HelpSybHealth Help. While this displays the PowerBuilder help file that is
included with the executables, you will be shown how to write code to display any
Windows help file.
25. Click HelpSybHealth Help. While this displays the PowerBuilder help file that is
included with the executables, you will be shown how to write code to display any
Windows help file.
26. Click HelpAbout. Notice the About window has no means to close it. Wait about
10 seconds and you will see this window closes itself. You will be coding a timer
event with instructions to automatically close this window.
26. Click HelpAbout. Notice the About window has no means to close it. Wait about
10 seconds and you will see this window closes itself. You will be coding a timer
event with instructions to automatically close this window.
27. As you are exploring the SybHealth application, you may notice some menu items or
toolbar icons that are not active. This is by design. Much more functionality will be
added to this same application in the FastTrack to PowerBuilder, Part II course.
27. As you are exploring the SybHealth application, you may notice some menu items or
toolbar icons that are not active. This is by design. Much more functionality will be
added to this same application in the FastTrack to PowerBuilder, Part II course.
28. Click on the Exit icon on the toolbar to stop the SybHealth application. This is what
you will build during the next five days.
28. Click on the Exit icon on the toolbar to stop the SybHealth application. This is what
you will build during the next five days.
Lab 1 - 8
Objectives:
Objectives:
Description:
In this lab, you will be shown how to configure and customize the PowerBuilder IDE.
You will be adding some custom icons on the PowerBar. You will assign some custom
shortcut keys to quickly enable/disable typical PowerBuilder features. And you will
review some of the System Options and their use.
Description:
In this lab, you will be shown how to configure and customize the PowerBuilder IDE.
You will be adding some custom icons on the PowerBar. You will assign some custom
shortcut keys to quickly enable/disable typical PowerBuilder features. And you will
review some of the System Options and their use.
Task Outline:
Task Outline:
Lab 2 - 1
Lab 2 - 1
Detailed Instructions
Detailed Instructions
Lab 2 - 2
1.
1.
2.
Right-click to the right of the Exit icon on the PowerBar (1st row of toolbar icons is
called the PowerBar) and select the Customize option on the context menu. The
Customize dialog appears.
2.
Right-click to the right of the Exit icon on the PowerBar (1st row of toolbar icons is
called the PowerBar) and select the Customize option on the context menu. The
Customize dialog appears.
3.
The selected palette is the PowerBar. Click an icon in the Selected Palette list view
and you will see the name of that icon display at the bottom of the Customize dialog.
3.
The selected palette is the PowerBar. Click an icon in the Selected Palette list view
and you will see the name of that icon display at the bottom of the Customize dialog.
4.
Drag the icon to Fully build the current target (this icon is only available on
PowerBuilder 11 and greater) down to the Current toolbar view and drop it before the
Go to next error message icon. You may click on the icons in the Current toolbar
view to determine their names.
4.
Drag the icon to Fully build the current target (this icon is only available on
PowerBuilder 11 and greater) down to the Current toolbar view and drop it before the
Go to next error message icon. You may click on the icons in the Current toolbar
view to determine their names.
5.
Click OK to close the Customize dialog. Your PowerBar should look as follows:
5.
Click OK to close the Customize dialog. Your PowerBar should look as follows:
6.
6.
Lab 2 - 2
7.
Drag the Fully build icon off of the Current toolbar view. This will remove the
icon from the PowerBar. Where you drag the icon is immaterial. Note: there is a
Reset button on the Customize dialog. Reset would remove all of the PowerBar
customizations. Do not close the Customize dialog.
7.
Drag the Fully build icon off of the Current toolbar view. This will remove the
icon from the PowerBar. Where you drag the icon is immaterial. Note: there is a
Reset button on the Customize dialog. Reset would remove all of the PowerBar
customizations. Do not close the Customize dialog.
8.
Next, in the Select Palette group box, change the radio button from PowerBar to
Custom. This will display a list of custom icons you may add to the PowerBar.
8.
Next, in the Select Palette group box, change the radio button from PowerBar to
Custom. This will display a list of custom icons you may add to the PowerBar.
9.
Click on the icons on the first row of custom icons. Notice how their name shows as
Unassigned custom icon (at the bottom of the Customize dialog).
9.
Click on the icons on the first row of custom icons. Notice how their name shows as
Unassigned custom icon (at the bottom of the Customize dialog).
10. On the first row of custom icons, click the last icon.
10. On the first row of custom icons, click the last icon.
11. Drag that icon down to the Current toolbar, to the left of the To-Do list icon.
11. Drag that icon down to the Current toolbar, to the left of the To-Do list icon.
12. The Toolbar Item Command dialog appears. Specify the following:
12. The Toolbar Item Command dialog appears. Specify the following:
(The command line may need to be adjusted for older versions of PowerBuilder.)
(The command line may need to be adjusted for older versions of PowerBuilder.)
Lab 2 - 3
Lab 2 - 3
15. Test your work. When you click on the HTML Books icon, you should see the
following:
15. Test your work. When you click on the HTML Books icon, you should see the
following:
Lab 2 - 4
1.
PowerBuilder provides some default Shortcut keys for the commonly used features of
the IDE. In this task, you will add some custom Shortcut keys.
1.
PowerBuilder provides some default Shortcut keys for the commonly used features of
the IDE. In this task, you will add some custom Shortcut keys.
2.
Make sure that you have no painters open, only PowerBuilder itself.
2.
Make sure that you have no painters open, only PowerBuilder itself.
3.
3.
Lab 2 - 4
4.
Lab 2 - 5
Lab 2 - 5
Lab 2 - 6
5.
The Keyboard Shortcuts dialog is context sensitive. The above dialog will look
different later as Painters are opened. The following is an example of what Keyboard
Shortcuts dialog looks like when the Window painter is open:
5.
The Keyboard Shortcuts dialog is context sensitive. The above dialog will look
different later as Painters are opened. The following is an example of what Keyboard
Shortcuts dialog looks like when the Window painter is open:
6.
With the Keyboard Shortcuts dialog open, expand the Tools node.
6.
With the Keyboard Shortcuts dialog open, expand the Tools node.
7.
7.
8.
Add a shortcut for the Browser. Click on Browser Then click to give focus to the
text box under the Press keys for shortcut label.
8.
Add a shortcut for the Browser. Click on Browser Then click to give focus to the
text box under the Press keys for shortcut label.
Lab 2 - 6
Press Ctrl-Shift-B on your keyboard. The text box will populate as follows:
9.
Lab 2 - 7
Press Ctrl-Shift-B on your keyboard. The text box will populate as follows:
Lab 2 - 7
Lab 2 - 8
10. Click OK to close the Keyboard Shortcuts dialog and then test your work. Press
Ctrl+Shift+B and you should see the following:
10. Click OK to close the Keyboard Shortcuts dialog and then test your work. Press
Ctrl+Shift+B and you should see the following:
Remember the Browser. It is one of the most invaluable helpers you have in the
PowerBuilder IDE.
Remember the Browser. It is one of the most invaluable helpers you have in the
PowerBuilder IDE.
Lab 2 - 8
11. Remember that Keyboard Shortcuts are context sensitive. Later, as you are in some
painters (like the Window or DataWindow painters), Ctrl+Shift+B is the default
shortcut to the Alternate Bold menu item. You cannot have duplicate Keyboard
Shortcuts. In order to use the Ctrl+Shift+B to access the Browser, you would have to
delete the duplicate Ctrl+Shift+B from the Alternate Bold menu item:
11. Remember that Keyboard Shortcuts are context sensitive. Later, as you are in some
painters (like the Window or DataWindow painters), Ctrl+Shift+B is the default
shortcut to the Alternate Bold menu item. You cannot have duplicate Keyboard
Shortcuts. In order to use the Ctrl+Shift+B to access the Browser, you would have to
delete the duplicate Ctrl+Shift+B from the Alternate Bold menu item:
(You cannot perform the Remove at this time, we have no Windows to open yet. This
step is strictly for information purposes.)
(You cannot perform the Remove at this time, we have no Windows to open yet. This
step is strictly for information purposes.)
12. Next, add the following shortcuts to the associated menu items:
12. Next, add the following shortcuts to the associated menu items:
c. WindowOutput Ctrl+Shift+O
c. WindowOutput Ctrl+Shift+O
d. WindowClip Ctrl+Shift+C
d. WindowClip Ctrl+Shift+C
Lab 2 - 9
Lab 2 - 9
Lab 2 - 10
1.
1.
2.
On the General tab of the System Options dialog, enable Just-In-Time Debugging.
With this option enabled, when you are testing your application via the IDE and you
encounter a fatal error, the PowerBuilder Debugger will automatically open showing
the object/event/line of code where the error occurred. You will be able to view
variables and their values and hopefully have a better idea of what caused the
problem. Without this option, you simply receive an error message and the
application terminates.
2.
On the General tab of the System Options dialog, enable Just-In-Time Debugging.
With this option enabled, when you are testing your application via the IDE and you
encounter a fatal error, the PowerBuilder Debugger will automatically open showing
the object/event/line of code where the error occurred. You will be able to view
variables and their values and hopefully have a better idea of what caused the
problem. Without this option, you simply receive an error message and the
application terminates.
3.
Note that Automatically Clear Output Window is enabled by default so that its
contents are overwritten instead of being appended.
3.
Note that Automatically Clear Output Window is enabled by default so that its
contents are overwritten instead of being appended.
4.
Click the Help button and spend a few minutes learning about some of the other
options seen here.
4.
Click the Help button and spend a few minutes learning about some of the other
options seen here.
5.
Next, click on the Workspaces tab, note the defaults of the following options:
5.
Next, click on the Workspaces tab, note the defaults of the following options:
Lab 2 - 10
6.
Change the Recent Object list value from the default of 8 to 15.
6.
Change the Recent Object list value from the default of 8 to 15.
7.
7.
Lab 2 - 11
Lab 2 - 11
Objectives:
Objectives:
Description:
In this lab, you will create the workspace that will be used for the remainder of the class.
You will add a target to this workspace that has already been created the PowerBuilder
Example Application as well as evaluate what happens when you remove a target. You
will also be exploring Workspace properties.
Description:
In this lab, you will create the workspace that will be used for the remainder of the class.
You will add a target to this workspace that has already been created the PowerBuilder
Example Application as well as evaluate what happens when you remove a target. You
will also be exploring Workspace properties.
Task Outline:
Task Outline:
Lab 2 - 12
Lab 2 - 12
Detailed Instructions
Detailed Instructions
1.
Right-click (No Workspace) in the System Tree and select New from the context
menu:
1.
Right-click (No Workspace) in the System Tree and select New from the context
menu:
2.
2.
3.
Click Save.
3.
Click Save.
4.
4.
Lab 2 - 13
Lab 2 - 13
1.
In the System Tree, right-click over your workspace. Select Add Target from the
context menu.
1.
In the System Tree, right-click over your workspace. Select Add Target from the
context menu.
2.
2.
3.
3.
4.
Add another target to your workspace. This time, the target is in the following
directory:
4.
Add another target to your workspace. This time, the target is in the following
directory:
5.
(The Advanced GUI target is only available in PowerBuilder 11 and greater. If you
are running an older version of PowerBuilder add the Example App\Benchmark target
instead.)
Lab 2 - 14
Lab 2 - 14
You now have two targets in your workspace. The System Tree should display as
follows:
You now have two targets in your workspace. The System Tree should display as
follows:
1.
1.
2.
Notice you have Incremental Build, Full Build and Deploy options on the context
menu. When you Build a workspace, you are re-compiling every script in every
object, of every target in the workspace. This could be time consuming. When you
Deploy, you are creating the executables for each of the targets contained in the
workspace.
2.
Notice you have Incremental Build, Full Build and Deploy options on the context
menu. When you Build a workspace, you are re-compiling every script in every
object, of every target in the workspace. This could be time consuming. When you
Deploy, you are creating the executables for each of the targets contained in the
workspace.
3.
3.
4.
The Targets tab of Workspace Properties allows you to control which targets get built
or deployed when you perform that option at the workspace level. Selecting a target
here and using the Up or Down arrows also lets you control the order of your builds
or deploys.
4.
The Targets tab of Workspace Properties allows you to control which targets get built
or deployed when you perform that option at the workspace level. Selecting a target
here and using the Up or Down arrows also lets you control the order of your builds
or deploys.
5.
5.
Lab 2 - 15
Lab 2 - 15
6.
6.
7.
7.
_____________________________________________________________________
8.
_____________________________________________________________________
Click the Source Control tab of the Properties of Workspace dialog. This is where
you come to enable the link between PowerBuilder and your Source Control system.
Write the names of the Source Control systems that are installed on your machine in
the space below:
8.
_____________________________________________________________________
9.
Lab 2 - 16
Click the Source Control tab of the Properties of Workspace dialog. This is where
you come to enable the link between PowerBuilder and your Source Control system.
Write the names of the Source Control systems that are installed on your machine in
the space below:
_____________________________________________________________________
This task has been for information purposes only. The class exercises do not require
use of Source Control. Make sure that the Source Control System option is set to
(None).
9.
This task has been for information purposes only. The class exercises do not require
use of Source Control. Make sure that the Source Control System option is set to
(None).
10. Using your System Tree, right-click over the advguisample target and select Remove
Target from the context menu.
10. Using your System Tree, right-click over the advguisample target and select Remove
Target from the context menu.
11. Removing a target does not delete the target from the machine. It just removes that
target from your workspace.
11. Removing a target does not delete the target from the machine. It just removes that
target from your workspace.
Lab 2 - 16
Objectives:
Objectives:
Description:
In this lab, you will be experimenting with PBLs and the Library List. PBLs are often
times re-used across multiple applications and/or between multiple developers. You will
add existing PBLs to the PB Examples application, remove PBLs and create new PBLs.
You will alter the order of the Library List evaluating the impact.
Description:
In this lab, you will be experimenting with PBLs and the Library List. PBLs are often
times re-used across multiple applications and/or between multiple developers. You will
add existing PBLs to the PB Examples application, remove PBLs and create new PBLs.
You will alter the order of the Library List evaluating the impact.
Task Outline:
Task Outline:
Lab 2 - 17
Lab 2 - 17
Detailed Instructions
Detailed Instructions
Lab 2 - 18
1.
In the PowerBuilder System Tree, expand the PB Examples target you added. Make
note that 12 PBLs make up the application.
1.
In the PowerBuilder System Tree, expand the PB Examples target you added. Make
note that 12 PBLs make up the application.
2.
Right-click over the PB Examples target and select Properties from the context menu.
Select the Library List tab.
2.
Right-click over the PB Examples target and select Properties from the context menu.
Select the Library List tab.
3.
Click on the Browse button to add existing PBLs to the Library List. Navigate to
the following directory:
3.
Click on the Browse button to add existing PBLs to the Library List. Navigate to
the following directory:
Select the pbexbm.pbl and click Open on the Select Library dialog.
Select the pbexbm.pbl and click Open on the Select Library dialog.
Lab 2 - 18
You will see a new line has been added to the bottom of the library list:
4.
You will see a new line has been added to the bottom of the library list:
5.
5.
6.
In the System Tree, expand the PB Examples target and you will see the pbexbm.pbl
and can expand it to see its contents. Adding this PBL gave the target access to
several new objects.
6.
In the System Tree, expand the PB Examples target and you will see the pbexbm.pbl
and can expand it to see its contents. Adding this PBL gave the target access to
several new objects.
7.
Using the System Tree, right-click over the pbexbm.pbl and select Remove Library.
When prompted, click Yes. The System Tree will update to reflect that change.
7.
Using the System Tree, right-click over the pbexbm.pbl and select Remove Library.
When prompted, click Yes. The System Tree will update to reflect that change.
8.
Remove Library does not delete a PBL; it just removes it from a target.
8.
Remove Library does not delete a PBL; it just removes it from a target.
1.
In the System Tree, right-click the PB Examples target and select Properties from
the context menu.
1.
In the System Tree, right-click the PB Examples target and select Properties from
the context menu.
2.
2.
3.
3.
Lab 2 - 19
Lab 2 - 19
4.
When prompted for comments, enter No Frills Source Control Checkout PBL.
Click OK.
4.
When prompted for comments, enter No Frills Source Control Checkout PBL.
Click OK.
5.
The Library List now shows your new checkout PBL at the bottom. Cut and paste,
moving that line to the top of the library list as shown below:
5.
The Library List now shows your new checkout PBL at the bottom. Cut and paste,
moving that line to the top of the library list as shown below:
6.
6.
7.
The System Tree now displays the checkout.pbl. This PBL is empty at this point.
7.
The System Tree now displays the checkout.pbl. This PBL is empty at this point.
Lab 2 - 20
1.
Right-click over the PB Examples Target in the System Tree and select Run.
1.
Right-click over the PB Examples Target in the System Tree and select Run.
2.
PB Examples main window displays categories of all of the examples. You can
expand a category to see a list of the example applications available.
2.
PB Examples main window displays categories of all of the examples. You can
expand a category to see a list of the example applications available.
3.
Under the Drag & Drop category, you will see three example applications. Double
click the Treeview Drag/Drop example.
3.
Under the Drag & Drop category, you will see three example applications. Double
click the Treeview Drag/Drop example.
Lab 2 - 20
4.
4.
5.
5.
6.
In the PB Examples interface, click the Related Objects tab (upper right).
6.
In the PB Examples interface, click the Related Objects tab (upper right).
7.
The example you just ran contains a window named w_employee_xfer and a
DataWindow named d_emp_by_dept.
7.
The example you just ran contains a window named w_employee_xfer and a
DataWindow named d_emp_by_dept.
8.
8.
9.
All of the example windows are in the PBLs named pbexamw1, 2 and 3. In the
System Tree, expand the PBL named pbexamw2.
9.
All of the example windows are in the PBLs named pbexamw1, 2 and 3. In the
System Tree, expand the PBL named pbexamw2.
10. Right-click over w_employee_xfer and select Copy from the context menu.
10. Right-click over w_employee_xfer and select Copy from the context menu.
11. On the Select Library dialog, navigate to your Student folder and select the
checkout.pbl. Click Open. You now have two exact copies of the same object.
11. On the Select Library dialog, navigate to your Student folder and select the
checkout.pbl. Click Open. You now have two exact copies of the same object.
12. In the System Tree, go up to the checkout.pbl and expand it. Double-click to open
w_employee_xfer in PowerBuilders Window painter.
12. In the System Tree, go up to the checkout.pbl and expand it. Double-click to open
w_employee_xfer in PowerBuilders Window painter.
Lab 2 - 21
Lab 2 - 21
Lab 2 - 22
13. In the Properties view of the Window painter (far right), scroll down until you see the
BackColor property. Change the value from Button Face to Active Title Bar (blue).
You will see the background of the layout change:
13. In the Properties view of the Window painter (far right), scroll down until you see the
BackColor property. Change the value from Button Face to Active Title Bar (blue).
You will see the background of the layout change:
14. Close the Window painter. Always close painters by clicking the X icon that is on the
PainterBar (the PainterBar is the 2nd row of toolbar icons).
14. Close the Window painter. Always close painters by clicking the X icon that is on the
PainterBar (the PainterBar is the 2nd row of toolbar icons).
16. Now, re-run the PB Examples application, and the Treeview Drag/Drop example as
we did above in step 3. You should see the change in the background color of the
window.
16. Now, re-run the PB Examples application, and the Treeview Drag/Drop example as
we did above in step 3. You should see the change in the background color of the
window.
17. The point of this exercise was to show you how you could check out an object (copy)
to your checkout PBL, make changes and test while the object is in the checkout PBL.
Since Checkout is at the top of the Library List, that version of the window is found
first when you run the application. The original object is preserved until you have
tested your changes and move the changed window back to its original PBL.
17. The point of this exercise was to show you how you could check out an object (copy)
to your checkout PBL, make changes and test while the object is in the checkout PBL.
Since Checkout is at the top of the Library List, that version of the window is found
first when you run the application. The original object is preserved until you have
tested your changes and move the changed window back to its original PBL.
18. When you are happy with the results, move the object from the checkout PBL back to
the original PBL (pbexamw2.pbl). The goal should be to ultimately clear out your
checkout PBL when you are ready to create executables for the end users.
18. When you are happy with the results, move the object from the checkout PBL back to
the original PBL (pbexamw2.pbl). The goal should be to ultimately clear out your
checkout PBL when you are ready to create executables for the end users.
Lab 2 - 22
Objectives:
Objectives:
Create the SybHealth application target that will be used during the remainder of the
labs
Create the SybHealth application target that will be used during the remainder of the
labs
Description:
In this lab, you will be creating the SybHealth application target that will be used in the
remainder of the labs. You will add some provided PBLs to the Library List. These PBLs
contain framework objects that you will use when building SybHealth. We do this to show
you best practices within PowerBuilder. Do not worry about the contents of these PBLs
right now. That will be explained to you later. You will be given detailed instructions
about the use of this framework in a later module.
Description:
In this lab, you will be creating the SybHealth application target that will be used in the
remainder of the labs. You will add some provided PBLs to the Library List. These PBLs
contain framework objects that you will use when building SybHealth. We do this to show
you best practices within PowerBuilder. Do not worry about the contents of these PBLs
right now. That will be explained to you later. You will be given detailed instructions
about the use of this framework in a later module.
Task Outline:
Task Outline:
Lab 2 - 23
Lab 2 - 23
Detailed Instructions
Detailed Instructions
Lab 2 - 24
1.
In the System Tree, right-click MyWorkspace and select New from the context
menu.
1.
In the System Tree, right-click MyWorkspace and select New from the context
menu.
2.
On the Target tab of the New dialog, select Application and click OK.
2.
On the Target tab of the New dialog, select Application and click OK.
3.
3.
4.
Click Finish.
4.
Click Finish.
5.
Right-click over SybHealth_target in the System Tree. Select Properties from the
context menu.
5.
Right-click over SybHealth_target in the System Tree. Select Properties from the
context menu.
6.
Clicking the New button, create three new PBLs for the Library List:
6.
Clicking the New button, create three new PBLs for the Library List:
a. C:\Sybase Courses\DEV134\Student\Patients.pbl
a. C:\Sybase Courses\DEV134\Student\Patients.pbl
b. C:\Sybase Courses\DEV134\Student\Doctors.pbl
b. C:\Sybase Courses\DEV134\Student\Doctors.pbl
c. C:\Sybase Courses\DEV134\Student\Claims.pbl
c. C:\Sybase Courses\DEV134\Student\Claims.pbl
Lab 2 - 24
1.
A framework is constantly evolving. To get you started, we have provided a miniframework that you will add to SybHealth. During labs, you will be using and/or
inheriting from objects in this framework. You will also be identifying changes
needed (properties and code) to framework objects. Dont try to understand it all
right now, you will by the end of the course.
1.
A framework is constantly evolving. To get you started, we have provided a miniframework that you will add to SybHealth. During labs, you will be using and/or
inheriting from objects in this framework. You will also be identifying changes
needed (properties and code) to framework objects. Dont try to understand it all
right now, you will by the end of the course.
2.
2.
a. C:\Sybase Courses\DEV134\Student\Framework\windows_base.pbl
a. C:\Sybase Courses\DEV134\Student\Framework\windows_base.pbl
b. C:\Sybase Courses\DEV134\Student\Framework\windows_abstract.pbl
b. C:\Sybase Courses\DEV134\Student\Framework\windows_abstract.pbl
c. C:\Sybase Courses\DEV134\Student\Framework\visual_controls_base.pbl
c. C:\Sybase Courses\DEV134\Student\Framework\visual_controls_base.pbl
d. C:\Sybase Courses\DEV134\Student\Framework\visual_controls_abstract.pbl
d. C:\Sybase Courses\DEV134\Student\Framework\visual_controls_abstract.pbl
3.
This will provide a starting point for our application. Other PBLs will be added later.
3.
This will provide a starting point for our application. Other PBLs will be added later.
4.
4.
Lab 2 - 25
Lab 2 - 25
Lab 2 - 26
5.
In the System Tree, expand your sybhealth PBL and double-click the a_sybhealth
Application Object to open the Application painter.
5.
In the System Tree, expand your sybhealth PBL and double-click the a_sybhealth
Application Object to open the Application painter.
6.
On the Properties view and enter SybHealth Patient Management System in the
DisplayName property.
6.
On the Properties view and enter SybHealth Patient Management System in the
DisplayName property.
7.
Enter Error Accessing Data in the DWMessageTitle property. This property will be
used in the title bar of default DataWindow error messages for your application:
7.
Enter Error Accessing Data in the DWMessageTitle property. This property will be
used in the title bar of default DataWindow error messages for your application:
8.
8.
9.
On the Icon tab, click the Browse button and select VOC.ICO from the Student
folder. This icon will be used as your application icon. The icon image will display
below the Browse button.
9.
On the Icon tab, click the Browse button and select VOC.ICO from the Student
folder. This icon will be used as your application icon. The icon image will display
below the Browse button.
Lab 2 - 26
10. Remove the path name from the Icon Name field, leaving only the file name.
10. Remove the path name from the Icon Name field, leaving only the file name.
11. On the other tab pages, make sure the default Text, Column, Header, and Label fonts
are set to Tahoma 10 point.
11. On the other tab pages, make sure the default Text, Column, Header, and Label fonts
are set to Tahoma 10 point.
12. Click OK to close the Application dialog and then click the Save button (Ctrl-S) to
store your changes in the PBL. You will do more with the Application Object in later
labs.
12. Click OK to close the Application dialog and then click the Save button (Ctrl-S) to
store your changes in the PBL. You will do more with the Application Object in later
labs.
13. Close the Application Painter. Again, remember to close painters by clicking the X
icon on the PainterBar.
13. Close the Application Painter. Again, remember to close painters by clicking the X
icon on the PainterBar.
Lab 2 - 27
Lab 2 - 27
Objectives:
Objectives:
Description:
Description:
Task Outline:
Task Outline:
Lab 2 - 28
Lab 2 - 28
Detailed Instructions
Detailed Instructions
1.
1.
2.
You cannot use FileOpen to edit a file within the editor. FileOpen opens
PowerBuilder objects. Instead, use FileOpen File (or click the Open icon on the
PainterBar).
2.
You cannot use FileOpen to edit a file within the editor. FileOpen opens
PowerBuilder objects. Instead, use FileOpen File (or click the Open icon on the
PainterBar).
3.
Look at the Files of Type drop down, to learn which types of files the File Editor is
capable of displaying.
3.
Look at the Files of Type drop down, to learn which types of files the File Editor is
capable of displaying.
4.
Set the Files of Type to Initialization files (INI). Navigate to your Student folder.
Select the SybHealth.ini file.
4.
Set the Files of Type to Initialization files (INI). Navigate to your Student folder.
Select the SybHealth.ini file.
5.
INI files are ASCII text files that contain key-value pairs of information. These keys
can be read by the application at any time, though typically at application startup,
hence the name Application Initialization file. Anyone may create an INI file with a
utility like PowerBuilders File Editor, or Windows Notepad.
5.
INI files are ASCII text files that contain key-value pairs of information. These keys
can be read by the application at any time, though typically at application startup,
hence the name Application Initialization file. Anyone may create an INI file with a
utility like PowerBuilders File Editor, or Windows Notepad.
6.
An INI file can have one to many sections. SybHealth.ini has only one section. Write
the section name below:
6.
An INI file can have one to many sections. SybHealth.ini has only one section. Write
the section name below:
_____________________________________________________________________
7.
_____________________________________________________________________
Each section can have one to many key-value pairs. Write the key names below
(dont worry about noting the values, you will write code to obtain the values later):
7.
Each section can have one to many key-value pairs. Write the key names below
(dont worry about noting the values, you will write code to obtain the values later):
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
8.
While in the File Editor, note the icons on the PainterBar. The File Editor has Find,
Find and Replace, and Save icons.
8.
While in the File Editor, note the icons on the PainterBar. The File Editor has Find,
Find and Replace, and Save icons.
9.
9.
10. Re-open the File Editor (there is no option to start a new document while in the File
Editor).
10. Re-open the File Editor (there is no option to start a new document while in the File
Editor).
11. You are now going to create a PowerBuilder Resource file (or PBR). This file will be
used when you create executables. Resource files are text files that are your
responsibility to create. A PBR file contains lines that identify each of the resources
used during development. Resources include ICONS (in lab 2-4 we used the voc.ico
file), PICTURES (JPGs, Bitmaps, GIFs, etc.) and CURSORS, etc.
11. You are now going to create a PowerBuilder Resource file (or PBR). This file will be
used when you create executables. Resource files are text files that are your
responsibility to create. A PBR file contains lines that identify each of the resources
used during development. Resources include ICONS (in lab 2-4 we used the voc.ico
file), PICTURES (JPGs, Bitmaps, GIFs, etc.) and CURSORS, etc.
Lab 2 - 29
Lab 2 - 29
12. Whenever you use a resource, such as a GIF in a Picture control, you should add the
location and filename to your PBR file.
12. Whenever you use a resource, such as a GIF in a Picture control, you should add the
location and filename to your PBR file.
15. On the Save dialog, navigate to your Student directory, change the Save As Type drop
down to Resource Files, and name the file SybHealth. The PBR extension will
automatically be appended.
15. On the Save dialog, navigate to your Student directory, change the Save As Type drop
down to Resource Files, and name the file SybHealth. The PBR extension will
automatically be appended.
Lab 2 - 30
1.
Click ToolsLibrary Painter on the menu (or click the Library icon on the
PowerBar).
1.
Click ToolsLibrary Painter on the menu (or click the Library icon on the
PowerBar).
2.
The default Library Painter looks like Windows Explorer. It has very similar
functionality. However, the true use of the Library Painter, is to provide a utility to
manage your PowerBuilder libraries (PBLs).
2.
The default Library Painter looks like Windows Explorer. It has very similar
functionality. However, the true use of the Library Painter, is to provide a utility to
manage your PowerBuilder libraries (PBLs).
3.
The default Library Painter has two views, a tree (left) and a list (right). In the Tree
view, right-click in a null area. You will see the context menu:
3.
The default Library Painter has two views, a tree (left) and a list (right). In the Tree
view, right-click in a null area. You will see the context menu:
4.
Select Set Root and when prompted, select Current Workspace and click OK.
4.
Select Set Root and when prompted, select Current Workspace and click OK.
5.
The Tree view of the Library Painter should now mirror that of the System Tree.
5.
The Tree view of the Library Painter should now mirror that of the System Tree.
Lab 2 - 30
6.
The Library Painter has been part of PowerBuilder for a long time. The System Tree
was new in PowerBuilder 8. Because it is typically in the foreground, developers tend
to use the System Tree more than the Library Painter; however, there are some good
reasons to use the Library Painter.
6.
The Library Painter has been part of PowerBuilder for a long time. The System Tree
was new in PowerBuilder 8. Because it is typically in the foreground, developers tend
to use the System Tree more than the Library Painter; however, there are some good
reasons to use the Library Painter.
7.
When in the Library Painter, remember is to use the Tree view as a navigator and the
List view when performing operations on the contents of PBLs. The Tree view does
not support multi-selecting objects. The List view does. The List view also provides
additional valuable information.
7.
When in the Library Painter, remember is to use the Tree view as a navigator and the
List view when performing operations on the contents of PBLs. The Tree view does
not support multi-selecting objects. The List view does. The List view also provides
additional valuable information.
8.
Using the Tree view of the Library Painter, expand the SybHealth_target and then
click (single-click), on the visual_controls_base.pbl. The contents of that PBL will
display in the List view as seen below:
8.
Using the Tree view of the Library Painter, expand the SybHealth_target and then
click (single-click), on the visual_controls_base.pbl. The contents of that PBL will
display in the List view as seen below:
9.
What valuable pieces of information does the List view contain beside the object
name?
9.
What valuable pieces of information does the List view contain beside the object
name?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
10. On the menu, click EntryLibraryCreate or click the Create Library icon on the
PainterBar.
10. On the menu, click EntryLibraryCreate or click the Create Library icon on the
PainterBar.
11. When prompted, create a new PBL named Trash in your Student folder. No
comments need to be added. Click Save.
11. When prompted, create a new PBL named Trash in your Student folder. No
comments need to be added. Click Save.
12. Did the System Tree or Library Painter display your new PBL? Are PBLs created in
the Library Painter added to the Library List?
12. Did the System Tree or Library Painter display your new PBL? Are PBLs created in
the Library Painter added to the Library List?
_____________________________________________________________________
Lab 2 - 31
_____________________________________________________________________
Lab 2 - 31
Lab 2 - 32
13. Use the Tree view of the Library Painter to navigate to the sybhealth_target. Expand
and click on the visual_controls_base.pbl, displaying its contents in the List view.
13. Use the Tree view of the Library Painter to navigate to the sybhealth_target. Expand
and click on the visual_controls_base.pbl, displaying its contents in the List view.
14. In the Library Painters List view, hold down the Ctrl key click to select the first 5
objects in that PBL. You could also perform a lasso select with the mouse.
14. In the Library Painters List view, hold down the Ctrl key click to select the first 5
objects in that PBL. You could also perform a lasso select with the mouse.
15. With your mouse over one of the selected objects, right-click and select Move from
the context menu. Move these objects to your new trash.pbl in your Student folder.
Click Open to complete the move. The point of the exercise is to never outright
delete objects. It is safer to move them to a temporary holding place, similar to the
Windows Recycle Bin.
15. With your mouse over one of the selected objects, right-click and select Move from
the context menu. Move these objects to your new trash.pbl in your Student folder.
Click Open to complete the move. The point of the exercise is to never outright
delete objects. It is safer to move them to a temporary holding place, similar to the
Windows Recycle Bin.
16. Now move those objects back into the visual_controls_base.pbl. There are many
ways to do this. One includes right-clicking over the Tree view of the Library Painter
and selecting Set Root
16. Now move those objects back into the visual_controls_base.pbl. There are many
ways to do this. One includes right-clicking over the Tree view of the Library Painter
and selecting Set Root
17. Select Directory under Set Root to. Browse to and select your Student folder. The
Tree view of the Library Painter will now show all PBLs in the directory you
specified. Click on the trash.pbl in the Tree view, select all of the objects, right-click
and Move back to the visual_controls_base.pbl that is in the \Student\Framework
folder.
17. Select Directory under Set Root to. Browse to and select your Student folder. The
Tree view of the Library Painter will now show all PBLs in the directory you
specified. Click on the trash.pbl in the Tree view, select all of the objects, right-click
and Move back to the visual_controls_base.pbl that is in the \Student\Framework
folder.
18. The Library Painter can also be used to compare contents of two PBLs. To do this,
you need to add a second List view to the painter. This is done by clicking
ViewList on the PowerBuilder menu bar.
18. The Library Painter can also be used to compare contents of two PBLs. To do this,
you need to add a second List view to the painter. This is done by clicking
ViewList on the PowerBuilder menu bar.
Lab 2 - 32
19. The new List view will appear horizontally across the bottom of the Library Painter.
By dragging and dropping a view, rearrange the painter so that it looks like the
following:
19. The new List view will appear horizontally across the bottom of the Library Painter.
By dragging and dropping a view, rearrange the painter so that it looks like the
following:
20. Once you have two list views, you can drag a PBL from the Tree view to any List
view creating a tool that allows you to compare PBL contents.
20. Once you have two list views, you can drag a PBL from the Tree view to any List
view creating a tool that allows you to compare PBL contents.
Lab 2 - 33
Lab 2 - 33
Lab 2 - 34
1.
The Database Profile painter is where you set up profiles that allow the IDE to have a
design-time connection to your database. Design-time connections are needed if you
create DataWindow objects, Query objects, put embedded SQL into events or
functions, etc.
1.
The Database Profile painter is where you set up profiles that allow the IDE to have a
design-time connection to your database. Design-time connections are needed if you
create DataWindow objects, Query objects, put embedded SQL into events or
functions, etc.
2.
2.
3.
The DB Profile painter has a tree view showing installed database interfaces. You
must know which DBMS and how you plan to connect in order to choose the correct
interface. For instance, a developer connecting to Microsoft SQL Server 2005 could
choose from several interfaces: SNC, ADO.NET, OLE-DB or ODBC. The choice of
interface is a decision you have to make.
3.
The DB Profile painter has a tree view showing installed database interfaces. You
must know which DBMS and how you plan to connect in order to choose the correct
interface. For instance, a developer connecting to Microsoft SQL Server 2005 could
choose from several interfaces: SNC, ADO.NET, OLE-DB or ODBC. The choice of
interface is a decision you have to make.
Lab 2 - 34
4.
PowerBuilder ships with a developer edition of Sybase SQL Anywhere 11, our
Mobile and Embedded database. In addition, PowerBuilder ships with a sample
database named EAS Demo DB V120. This database contains tables with customers,
products, employees, orders, etc. PowerBuilder installs a DB Profile for the EAS
Demo DB V120 automatically:
4.
PowerBuilder ships with a developer edition of Sybase SQL Anywhere 11, our
Mobile and Embedded database. In addition, PowerBuilder ships with a sample
database named EAS Demo DB V120. This database contains tables with customers,
products, employees, orders, etc. PowerBuilder installs a DB Profile for the EAS
Demo DB V120 automatically:
5.
Expand the ODBC node and you will see the EAS Demo DB V120 profile. Rightclick over that profile and select Connect from the context menu. If you receive no
errors, then you are successfully connected.
5.
Expand the ODBC node and you will see the EAS Demo DB V120 profile. Rightclick over that profile and select Connect from the context menu. If you receive no
errors, then you are successfully connected.
Lab 2 - 35
Lab 2 - 35
6.
Re-open the DB Profile painter and look under the ODBC node again. Your painter
should look like the following:
6.
Re-open the DB Profile painter and look under the ODBC node again. Your painter
should look like the following:
7.
Notice the small green checkmark to the left of the EAS Demo DB V120 profile.
That mark indicates you are connected.
7.
Notice the small green checkmark to the left of the EAS Demo DB V120 profile.
That mark indicates you are connected.
8.
Next, right-click over the EAS Demo DB V120 Unicode profile and select Connect
8.
Next, right-click over the EAS Demo DB V120 Unicode profile and select Connect
9.
Re-open DB Profile.
9.
Re-open DB Profile.
10. Is it possible, at design time (in the IDE), to have concurrent active connections to
more than one database?
Lab 2 - 36
10. Is it possible, at design time (in the IDE), to have concurrent active connections to
more than one database?
_____________________________________________________________________
_____________________________________________________________________
11. Right-click over EAS Demo DB V120 again. Select Set As Active Connection. Note
how the green check mark is switching with the active connection.
11. Right-click over EAS Demo DB V120 again. Select Set As Active Connection. Note
how the green check mark is switching with the active connection.
13. Next, we will set up a DB Profile for the SybHealth database. Remember, that in
Module 1s lab, we created an ODBC DSN to the SybHealth database so that we
could run the final solution. That is the first step toward creating an ODBC profile.
13. Next, we will set up a DB Profile for the SybHealth database. Remember, that in
Module 1s lab, we created an ODBC DSN to the SybHealth database so that we
could run the final solution. That is the first step toward creating an ODBC profile.
14. In the DB Profile painter select the ODBC node. This enables the New button.
Click New to create a DB Profile.
14. In the DB Profile painter select the ODBC node. This enables the New button.
Click New to create a DB Profile.
Lab 2 - 36
15. Set the Profile Name to SybHealth. Select the SybHealth Data Source (this is the
DSN we created in Lab 1) using the drop down.
15. Set the Profile Name to SybHealth. Select the SybHealth Data Source (this is the
DSN we created in Lab 1) using the drop down.
Lab 2 - 37
Lab 2 - 37
1.
Learning about the database schema is an important task to any developer. You will
now learn how to use the Database Painter to better understand the SybHealth
schema.
1.
Learning about the database schema is an important task to any developer. You will
now learn how to use the Database Painter to better understand the SybHealth
schema.
2.
2.
3.
The Tree view on the left looks like the DB Profile painter. However, it adds more
detail.
3.
The Tree view on the left looks like the DB Profile painter. However, it adds more
detail.
4.
Drill down into the SybHealth profile and then expand the Tables folder. You will
see all of the SybHealth table names listed.
4.
Drill down into the SybHealth profile and then expand the Tables folder. You will
see all of the SybHealth table names listed.
5.
Drill down into any table and you will be able to learn column names by expanding
the Columns folder.
5.
Drill down into any table and you will be able to learn column names by expanding
the Columns folder.
6.
Expand the claims table, and then expand the Columns folder. Double click the
amount_paid column. This will display the columns properties in the upper right
view.
6.
Expand the claims table, and then expand the Columns folder. Double click the
amount_paid column. This will display the columns properties in the upper right
view.
7.
7.
_____________________________________________________________________
8.
Lab 2 - 38
_____________________________________________________________________
In addition to using the Tree view, you can graphically depict tables and their
relationships in the Object Layout view (tab -- upper, center of the painter).
Fast Track to PowerBuilder, Part I Version 1.0
8.
Lab 2 - 38
In addition to using the Tree view, you can graphically depict tables and their
relationships in the Object Layout view (tab -- upper, center of the painter).
Fast Track to PowerBuilder, Part I Version 1.0
When the Object Layout is active, you can drag a table from the Tree view to the
Object Layout view. Drag the claims table there. In a null area of the Object Layout
view, right-click and enable the showing of data types. Your display should look as
follows:
9.
When the Object Layout is active, you can drag a table from the Tree view to the
Object Layout view. Drag the claims table there. In a null area of the Object Layout
view, right-click and enable the showing of data types. Your display should look as
follows:
11. The blue keys indicate columns that are foreign keys.
11. The blue keys indicate columns that are foreign keys.
12. Right-click over the blue key associated with the claim_code column. Select Open
Referenced Table on the context menu. Your object layout will look as follows:
12. Right-click over the blue key associated with the claim_code column. Select Open
Referenced Table on the context menu. Your object layout will look as follows:
13. You can view the entire schema graphically, where we show keys, indexes, and
column types. There is a print icon, but the printed version is text only, no graphics.
13. You can view the entire schema graphically, where we show keys, indexes, and
column types. There is a print icon, but the printed version is text only, no graphics.
Lab 2 - 39
Lab 2 - 39
Lab 2 - 40
14. You have learned that the Database Painter is an information utility that will help the
developer perform his job in writing PowerBuilder applications.
14. You have learned that the Database Painter is an information utility that will help the
developer perform his job in writing PowerBuilder applications.
15. If you had the appropriate database rights, you could alter tables, create tables, and
perform other DBA-type activities, here in PowerBuilders Database Painter. You
will learn more about the Database Painter in later modules.
15. If you had the appropriate database rights, you could alter tables, create tables, and
perform other DBA-type activities, here in PowerBuilders Database Painter. You
will learn more about the Database Painter in later modules.
Lab 2 - 40
Objectives:
Objectives:
Description:
In this lab, you will be configuring the Window and DataWindow painter views so that
they allow you to be more productive during different phases of development by gaining
more screen real-estate in which to work.
Procedure
In this lab, you will be configuring the Window and DataWindow painter views so that
they allow you to be more productive during different phases of development by gaining
more screen real-estate in which to work.
Procedure
1.
This task will use one of the windows from the PB Examples application to configure
the Window painter.
1.
This task will use one of the windows from the PB Examples application to configure
the Window painter.
2.
From the System Tree, expand the PB Examples target, then the pbexamfe.pbl.
2.
From the System Tree, expand the PB Examples target, then the pbexamfe.pbl.
3.
3.
4.
Using the Xs on each of the views, close all views, but do not close the Window
painter:
4.
Using the Xs on each of the views, close all views, but do not close the Window
painter:
Lab 2 - 41
Lab 2 - 41
Lab 2 - 42
You will still see the Window painters title bar but no views:
5.
You will still see the Window painters title bar but no views:
6.
6.
7.
7.
8.
8.
9.
9.
Lab 2 - 42
10. When prompted, name the new layout Window Layout Only:
10. When prompted, name the new layout Window Layout Only:
11. Click ViewLayoutsDefault to return the Window painter to the way it was
configured originally. Remember this option.
11. Click ViewLayoutsDefault to return the Window painter to the way it was
configured originally. Remember this option.
12. Configure the Window painter to contain only the Layout and Script Editor view.
Remember, after you add views, you can drag the views around anywhere within the
painter. You can also resize views. The point is to make the painters work for you.
Save your layout as Window Layout and Script. You can create many views for a
given painter. Your Window Painter should look like the following:
12. Configure the Window painter to contain only the Layout and Script Editor view.
Remember, after you add views, you can drag the views around anywhere within the
painter. You can also resize views. The point is to make the painters work for you.
Save your layout as Window Layout and Script. You can create many views for a
given painter. Your Window Painter should look like the following:
Lab 2 - 43
Lab 2 - 43
Lab 2 - 44
13. Reset the Window Painter to the default views (ViewLayoutsDefault) and close
the Window painter.
13. Reset the Window Painter to the default views (ViewLayoutsDefault) and close
the Window painter.
14. This process can be performed for any painter in PowerBuilder, not just the Window
Painter.
14. This process can be performed for any painter in PowerBuilder, not just the Window
Painter.
Lab 2 - 44
Objectives:
Objectives:
Description:
In this lab, you will be using the FileOpen dialog to locate objects when you do not
know which PBL they reside in. You will also experiment with the Search capabilities of
PowerBuilder. Searching will be especially important to the developer.
Description:
In this lab, you will be using the FileOpen dialog to locate objects when you do not
know which PBL they reside in. You will also experiment with the Search capabilities of
PowerBuilder. Searching will be especially important to the developer.
Task Outline:
Task Outline:
Lab 2 - 45
Lab 2 - 45
Detailed Instructions
Detailed Instructions
Lab 2 - 46
1.
This task will allow you to see some navigation features that are built into the IDE.
You will again be using the PB Examples application in your workspace.
1.
This task will allow you to see some navigation features that are built into the IDE.
You will again be using the PB Examples application in your workspace.
2.
Using the System Tree, drill down into the w_about window in the pbexamfe.pbl.
After expanding the window, expand the Controls folder.
2.
Using the System Tree, drill down into the w_about window in the pbexamfe.pbl.
After expanding the window, expand the Controls folder.
3.
3.
4.
4.
5.
The icons tell which events have been coded for an object (this feature only available
in PowerBuilder 11 or greater).
5.
The icons tell which events have been coded for an object (this feature only available
in PowerBuilder 11 or greater).
6.
Double-click on the clicked( ) event. The painter should open taking you directly to
that event.
6.
Double-click on the clicked( ) event. The painter should open taking you directly to
that event.
7.
7.
8.
Next, we will make use of the PowerBuilder Open dialog to open an object instead of
using the System Tree.
8.
Next, we will make use of the PowerBuilder Open dialog to open an object instead of
using the System Tree.
9.
When using the Open dialog (FileOpen or Open icon on the PowerBar), you first
select a target, then select the PBLs (can multi-select PBLs) you wish to allow the
dialog to search through, and finally select the type of object (Objects of Type drop
down) you wish to view. PBLs and displayed objects can be multi-selected on the
Open dialog by holding down the Ctrl key while clicking.
9.
When using the Open dialog (FileOpen or Open icon on the PowerBar), you first
select a target, then select the PBLs (can multi-select PBLs) you wish to allow the
dialog to search through, and finally select the type of object (Objects of Type drop
down) you wish to view. PBLs and displayed objects can be multi-selected on the
Open dialog by holding down the Ctrl key while clicking.
11. Next, use the Open dialog to open w_date_functions, w_date_sort and
w_date_window simultaneously.
11. Next, use the Open dialog to open w_date_functions, w_date_sort and
w_date_window simultaneously.
Lab 2 - 46
12. Remember, PowerBuilder itself is an MDI (Multiple Document Interface) type IDE.
On PowerBuilders menu, select Window to see the list of the four objects you have
opened in the IDE.
12. Remember, PowerBuilder itself is an MDI (Multiple Document Interface) type IDE.
On PowerBuilders menu, select Window to see the list of the four objects you have
opened in the IDE.
2.
Using the System Tree and right-clicking, on what three levels can you Search?
1.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Search for all DataWindows that use the Employee table. Right-click over the PB
Examples target, select Search and enter the following criteria:
2.
TABLE(NAME=~"employee~"
3.
Search for all DataWindows that use the Employee table. Right-click over the PB
Examples target, select Search and enter the following criteria:
TABLE(NAME=~"employee~"
3.
_____________________________________________________________________
4.
Using the System Tree and right-clicking, on what three levels can you Search?
In the view identified above, what functions can you perform on the search results
list?
4.
In the view identified above, what functions can you perform on the search results
list?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
5.
5.
6.
Double-click over a blue line in the Search results. PowerBuilder will open the
appropriate object/painter and position you on the code where SetTransObject was
found. The cursor is not positioned on the exact line where SetTransObject was
found. The Ctrl-Shift-G (Go To) keyboard shortcut, in conjunction with the line
number shown in the search results will get you to the code quickly.
6.
Double-click over a blue line in the Search results. PowerBuilder will open the
appropriate object/painter and position you on the code where SetTransObject was
found. The cursor is not positioned on the exact line where SetTransObject was
found. The Ctrl-Shift-G (Go To) keyboard shortcut, in conjunction with the line
number shown in the search results will get you to the code quickly.
Lab 2 - 47
Lab 2 - 47
Objectives:
Objectives:
Find other valuable information about PowerBuilder from the provided resources
Find other valuable information about PowerBuilder from the provided resources
Description:
In this lab, you will be using Internet Explorer to locate valuable resources that will assist
you with PowerBuilder questions or help.
Description:
In this lab, you will be using Internet Explorer to locate valuable resources that will assist
you with PowerBuilder questions or help.
Procedure
1.
Procedure
1.
2.
2.
3.
3.
4.
Most of the books are also downloadable as PDF versions. Watch for the PDF icon.
4.
Most of the books are also downloadable as PDF versions. Watch for the PDF icon.
5.
5.
6.
Navigate to www.sybase.com. At the top of the Sybase Homepage, you will find a
Support & Downloads link that when clicked drops down a list of choices. One of the
choices is Newsgroups. Click Newsgroups.
6.
Navigate to www.sybase.com. At the top of the Sybase Homepage, you will find a
Support & Downloads link that when clicked drops down a list of choices. One of the
choices is Newsgroups. Click Newsgroups.
7.
7.
Lab 2 - 48
Lab 2 - 48
8.
8.
9.
9.
Lab 2 - 49
Lab 2 - 49
Lab 2 - 50
10. The topics are listed, but you can drill down into more detail by clicking the
hyperlinks. You can also see how people responded to questions.
10. The topics are listed, but you can drill down into more detail by clicking the
hyperlinks. You can also see how people responded to questions.
12. CodeXchange is a site, as the name suggests, where developers like you can share
code examples with the Sybase community. Download and use at your own risk.
12. CodeXchange is a site, as the name suggests, where developers like you can share
code examples with the Sybase community. Download and use at your own risk.
13. Spend a few minutes navigating thru CodeXchange. On entry to that site, look for the
PowerBuilder project hyperlink:
13. Spend a few minutes navigating thru CodeXchange. On entry to that site, look for the
PowerBuilder project hyperlink:
14. Once in the PowerBuilder project you have access to the examples:
14. Once in the PowerBuilder project you have access to the examples:
Lab 2 - 50
Objectives:
Objectives:
Create a structure
Create a structure
Description:
In this lab, you are given a window that will calculate the amount to be paid based on a
claim amount, the type of claim, and the policyholders insurance coverage type. You will
read values, perform a calculation and then write the payment amount back to a control on
the window. This window will also be used in later labs to implement other techniques as
you learn more.
Description:
In this lab, you are given a window that will calculate the amount to be paid based on a
claim amount, the type of claim, and the policyholders insurance coverage type. You will
read values, perform a calculation and then write the payment amount back to a control on
the window. This window will also be used in later labs to implement other techniques as
you learn more.
Task Outline:
Task Outline:
Lab 3 - 1
Lab 3 - 1
Lab Workbook
Lab Workbook
Detailed Instructions
Detailed Instructions
1.
In the Student folder you will find a w_claim_calculator.srw file. This source file
contains the window you see below, however, it contains no scripts. Scripting the
Claim Calculator window will be done during this lab.
1.
In the Student folder you will find a w_claim_calculator.srw file. This source file
contains the window you see below, however, it contains no scripts. Scripting the
Claim Calculator window will be done during this lab.
2.
Using the System Tree, right-click over the claims.pbl in the sybhealth_target. Select
Import. Navigate and select w_claim_calculator.srw in the \Student folder.
2.
Using the System Tree, right-click over the claims.pbl in the sybhealth_target. Select
Import. Navigate and select w_claim_calculator.srw in the \Student folder.
3.
After you have imported the source file, use the System Tree to open the
w_claim_calculator window. The window should look as follows:
3.
After you have imported the source file, use the System Tree to open the
w_claim_calculator window. The window should look as follows:
1.
There are always different coding techniques to complete a requirement. The coding
we will perform here may not be the most efficient, or use the best practice, but they
will correspond to what was taught in Module 3. More techniques will be learned in
later modules/labs. All learning is not complete at this point.
1.
There are always different coding techniques to complete a requirement. The coding
we will perform here may not be the most efficient, or use the best practice, but they
will correspond to what was taught in Module 3. More techniques will be learned in
later modules/labs. All learning is not complete at this point.
2.
When the window is run, the first thing a user will do is select a Coverage Type.
Determine the default event for a Radio button control and write that in the space
provided below:
2.
When the window is run, the first thing a user will do is select a Coverage Type.
Determine the default event for a Radio button control and write that in the space
provided below:
_____________________________________________________________________
Lab 3 - 2
_____________________________________________________________________
Lab 3 - 2
When the user clicks a Radio button, your code will set a value into a variable
indicating either Basic (B) or Premium (P) was selected. What data type will you
choose to hold B or P?
3.
_____________________________________________________________________
_____________________________________________________________________
4.
Since the clicking of the Radio button is independent of the clicking of the Calculate
button, create an Instance variable on the window of type Char with the name of
ic_cover_type. Set the default value of this variable to B. Always save after
creating an Instance variable.
4.
Since the clicking of the Radio button is independent of the clicking of the Calculate
button, create an Instance variable on the window of type Char with the name of
ic_cover_type. Set the default value of this variable to B. Always save after
creating an Instance variable.
5.
In the Clicked event of the Basic Coverage Radio button, code the following:
5.
In the Clicked event of the Basic Coverage Radio button, code the following:
ic_cover_type = B
6.
ic_cover_type = B
In the Clicked event of the Premium Coverage Radio button, code the following:
6.
ic_cover_type = P
When the user clicks a Radio button, your code will set a value into a variable
indicating either Basic (B) or Premium (P) was selected. What data type will you
choose to hold B or P?
In the Clicked event of the Premium Coverage Radio button, code the following:
ic_cover_type = P
7.
The Calculate button is named cb_test. Right-click over the button and select Script
from the context menu. Verify that you are in cb_test and on its Clicked event.
7.
The Calculate button is named cb_test. Right-click over the button and select Script
from the context menu. Verify that you are in cb_test and on its Clicked event.
8.
8.
Lab 3 - 3
Lab 3 - 3
Lab Workbook
Lab Workbook
9.
Claim Amount and Amount Paid are EditMask controls. Open WinHelp (F1) and on
the Index tab, type EditMask Control. Double click EditMask Control in the list box
to open the details:
9.
10. Any time you type an object into the WinHelp index, you will see a cover page for
that object, briefly describing that object. For any object, there will always be three
buttons across the top of the cover page Properties, Events and Functions. Click the
Functions button:
Lab 3 - 4
Claim Amount and Amount Paid are EditMask controls. Open WinHelp (F1) and on
the Index tab, type EditMask Control. Double click EditMask Control in the list box
to open the details:
10. Any time you type an object into the WinHelp index, you will see a cover page for
that object, briefly describing that object. For any object, there will always be three
buttons across the top of the cover page Properties, Events and Functions. Click the
Functions button:
Lab 3 - 4
11. When the Calculate button is clicked, your code will need to read from the Claim
Amount EditMask (named em_amount), putting the value read into the
ldbl_claim_amt variable. Looking at the function names in WinHelp, which one will
you call to read the data in an EditMask?
11. When the Calculate button is clicked, your code will need to read from the Claim
Amount EditMask (named em_amount), putting the value read into the
ldbl_claim_amt variable. Looking at the function names in WinHelp, which one will
you call to read the data in an EditMask?
_____________________________________________________________________
_____________________________________________________________________
12. Review the GetData function in WinHelp. When prompted, choose Syntax 2 (getting
unformatted data from an Edit Mask control).
12. Review the GetData function in WinHelp. When prompted, choose Syntax 2 (getting
unformatted data from an Edit Mask control).
13. Close WinHelp and go back to cb_tests Clicked event. After the variable
declarations, code the following:
13. Close WinHelp and go back to cb_tests Clicked event. After the variable
declarations, code the following:
em_amount.getdata(ldbl_claim_amt)
em_amount.getdata(ldbl_claim_amt)
14. The Claim Type is a DropDownListBox control named ddlb_claimtype. Click the
Layout tab at the bottom of the Window painter, and then click on the
DropDownListBox control, giving it focus.
14. The Claim Type is a DropDownListBox control named ddlb_claimtype. Click the
Layout tab at the bottom of the Window painter, and then click on the
DropDownListBox control, giving it focus.
15. Look to the right of the painter, in the Properties view. You will see tabs across the
top. Click the Items tab.
15. Look to the right of the painter, in the Properties view. You will see tabs across the
top. Click the Items tab.
_____________________________________________________________________
_____________________________________________________________________
17. Click the General tab in the Properties view. Notice there is a Text property on a
DropDownListBox. The item the user chooses will be placed into the Text property.
17. Click the General tab in the Properties view. Notice there is a Text property on a
DropDownListBox. The item the user chooses will be placed into the Text property.
18. Still in Properties of the DDLB, enable the AllowEdit property. The Text property
becomes enabled.
18. Still in Properties of the DDLB, enable the AllowEdit property. The Text property
becomes enabled.
19. Click on the Text property and set the value to HSPTL.
19. Click on the Text property and set the value to HSPTL.
20. Disable the AllowEdit property. You have just provided a default item for your list
box.
20. Disable the AllowEdit property. You have just provided a default item for your list
box.
string ls_claim_type
string ls_claim_type
23. After the statement getting the Claim Amount, write the following:
ls_claim_type = ddlb_claimtype.text
23. After the statement getting the Claim Amount, write the following:
ls_claim_type = ddlb_claimtype.text
24. Next, write a CHOOSE CASE statement, evaluating the contents of ls_claim_type.
The three cases will be that of the items you identified above in the
DropDownListBox.
24. Next, write a CHOOSE CASE statement, evaluating the contents of ls_claim_type.
The three cases will be that of the items you identified above in the
DropDownListBox.
25. You will need to embed IF statements within the case to allow for the following
business rule(s):
25. You will need to embed IF statements within the case to allow for the following
business rule(s):
Lab 3 - 5
Lab 3 - 5
Lab Workbook
Lab Workbook
a. Type HSPTL (Hospital)
c. Type MEDEX
Lab 3 - 6
c. Type MEDEX
26. Code the above business logic into the event, catching the payment about into the
ldbl_amt_paid variable.
26. Code the above business logic into the event, catching the payment about into the
ldbl_amt_paid variable.
27. Write the contents of the ldbl_amt_paid variable out to the EditMask named
em_paids Text property. You will have to convert the double to a string using the
String( ) PowerScript function.
27. Write the contents of the ldbl_amt_paid variable out to the EditMask named
em_paids Text property. You will have to convert the double to a string using the
String( ) PowerScript function.
Lab 3 - 6
28. Your final code in cb_tests Clicked event might look like:
28. Your final code in cb_tests Clicked event might look like:
30. Using the System Tree, right-click over w_claim_calculator and select
Run/Previewfrom the context menu.
30. Using the System Tree, right-click over w_claim_calculator and select
Run/Previewfrom the context menu.
31. Test your work using the business rules outlined in step 25.
31. Test your work using the business rules outlined in step 25.
32. Close the window after you are satisfied with your results.
32. Close the window after you are satisfied with your results.
33. Close any open painters. Remember to use the X icon on the PainterBar to close a
painter.
33. Close any open painters. Remember to use the X icon on the PainterBar to close a
painter.
35. On the PB Object tab, select the Structure icon and click OK.
35. On the PB Object tab, select the Structure icon and click OK.
Lab 3 - 7
Lab 3 - 7
Lab Workbook
Lab Workbook
36. This structure will hold patient information that will be passed between objects in a
later lab.
36. This structure will hold patient information that will be passed between objects in a
later lab.
integer patient_id
string patient_first_name
string patient_last_name
string patient_state
Lab 3 - 8
integer patient_id
string patient_first_name
string patient_last_name
string patient_state
38. Save the structure with the name s_patient_info. Be sure to save the structure into the
patients.pbl.
38. Save the structure with the name s_patient_info. Be sure to save the structure into the
patients.pbl.
Lab 3 - 8
Objectives:
Objectives:
Description:
In this lab, you will continue to use the Claim Calculator window to understand more
coding techniques. You will remove the functionality you wrote in the Calculate button in
Lab 3 and place the code in an un-mapped user event, then in an object (window) function,
then a global function. A true implementation would choose one of these methods, but the
labs purpose is to give you practice at creating and calling the various types of methods.
You will also create a mapped event looking for a certain keystroke combination. You
will make use of a Windows API function (external). Pronouns will also be used in this
lab. You will write a function in the Application object to write fatal errors out to a file
system. And, you will be walked through the use of the Debugger.
Description:
In this lab, you will continue to use the Claim Calculator window to understand more
coding techniques. You will remove the functionality you wrote in the Calculate button in
Lab 3 and place the code in an un-mapped user event, then in an object (window) function,
then a global function. A true implementation would choose one of these methods, but the
labs purpose is to give you practice at creating and calling the various types of methods.
You will also create a mapped event looking for a certain keystroke combination. You
will make use of a Windows API function (external). Pronouns will also be used in this
lab. You will write a function in the Application object to write fatal errors out to a file
system. And, you will be walked through the use of the Debugger.
Task Outline:
Task Outline:
Lab 4 - 1
Lab 4 - 1
Detailed Instructions
Detailed Instructions
1.
This task will have you add functionality to the claim calculator so that when the user
has focus on the Amount Paid EditMask and presses the Ctrl+S key combination, a
prompt will ask if they want to save this information. For this exercise, you will not
actually save; just prompt the user.
1.
This task will have you add functionality to the claim calculator so that when the user
has focus on the Amount Paid EditMask and presses the Ctrl+S key combination, a
prompt will ask if they want to save this information. For this exercise, you will not
actually save; just prompt the user.
2.
Open w_claim_calculator.
2.
Open w_claim_calculator.
3.
3.
4.
The mapped event will be added to the em_paid EditMask, so make sure that em_paid
is displayed in the object dropdown (1st dropdown) in the script view.
4.
The mapped event will be added to the em_paid EditMask, so make sure that em_paid
is displayed in the object dropdown (1st dropdown) in the script view.
5.
Using the event list (2nd dropdown), select (New Event), which is always at the top of
the list.
5.
Using the event list (2nd dropdown), select (New Event), which is always at the top of
the list.
6.
Mapped events prototypes (or signatures) are protected, so tab to the Event name and
type ue_keydown and tab again.
6.
Mapped events prototypes (or signatures) are protected, so tab to the Event name and
type ue_keydown and tab again.
7.
7.
8.
8.
_____________________________________________________________________
9.
Lab 4 - 2
_____________________________________________________________________
9.
_____________________________________________________________________
_____________________________________________________________________
10. Open the Browser, and select the Enumerated tab. Locate and select Keycode. Then
double click properties. This will give you an idea of the enumerated values for keys.
Write below, the enumerated for the Alt key and the S key:
10. Open the Browser, and select the Enumerated tab. Locate and select Keycode. Then
double click properties. This will give you an idea of the enumerated values for keys.
Write below, the enumerated for the Alt key and the S key:
_____________________________________________________________________
_____________________________________________________________________
12. In WinHelp (F1), look up Key PowerScript event. Here, help defines for you how the
KeyFlags argument may be used. A value of 1 means the Shift key was used in
conjunction with the key press. 2 means the Ctrl key was used, etc.
12. In WinHelp (F1), look up Key PowerScript event. Here, help defines for you how the
KeyFlags argument may be used. A value of 1 means the Shift key was used in
conjunction with the key press. 2 means the Ctrl key was used, etc.
13. Code your ue_keydown event so that when Ctrl+S is pressed, you display a
MessageBox asking the user if they want to save. Provide two options on the
MessageBox, a Yes and a No button. Make the Yes button the default button. If the
user clicks Yes, display another MessageBox telling them the information was saved.
If the user clicks No, close the window (using a pronoun when calling the Close( )
function).
13. Code your ue_keydown event so that when Ctrl+S is pressed, you display a
MessageBox asking the user if they want to save. Provide two options on the
MessageBox, a Yes and a No button. Make the Yes button the default button. If the
user clicks Yes, display another MessageBox telling them the information was saved.
If the user clicks No, close the window (using a pronoun when calling the Close( )
function).
Lab 4 - 2
14. Using the System Tree, right-click over w_claim_calculator and select
Run/Preview from the context menu. Test your work. Remember, focus has to be
on the Amount Paid control before you press Ctrl+S.
14. Using the System Tree, right-click over w_claim_calculator and select
Run/Preview from the context menu. Test your work. Remember, focus has to be
on the Amount Paid control before you press Ctrl+S.
15. Close the running claim calculator window and return to the Window painter.
15. Close the running claim calculator window and return to the Window painter.
1.
In Lab 3, you coded the Calculate buttons Clicked event. You will now create an unmapped user event, placing the code from the Clicked event into your user event
instead. You will then write code to trigger the user event.
1.
In Lab 3, you coded the Calculate buttons Clicked event. You will now create an unmapped user event, placing the code from the Clicked event into your user event
instead. You will then write code to trigger the user event.
2.
2.
3.
Add a new user event to the window. Make sure the first drop down reads
w_claim_calculator before you add the new event.
3.
Add a new user event to the window. Make sure the first drop down reads
w_claim_calculator before you add the new event.
4.
Remember, un-mapped user events are not all that different that writing a function.
You define the return type, event name and arguments if any.
4.
Remember, un-mapped user events are not all that different that writing a function.
You define the return type, event name and arguments if any.
5.
Leave the Return type (None). Tab to the Event Name field.
5.
Leave the Return type (None). Tab to the Event Name field.
6.
Name this event ue_calculate. Always press the tab key (or the Enter key) after
entering any data in the prototype of a method in PowerBuilder. Failure to do so will
cause errors.
6.
Name this event ue_calculate. Always press the tab key (or the Enter key) after
entering any data in the prototype of a method in PowerBuilder. Failure to do so will
cause errors.
7.
7.
8.
Using the first drop down in the Script view, navigate to cb_test. PowerBuilder will
take you to the last event you were coding. In this case, you should be returned to
cb_tests Clicked event.
8.
Using the first drop down in the Script view, navigate to cb_test. PowerBuilder will
take you to the last event you were coding. In this case, you should be returned to
cb_tests Clicked event.
9.
Click in the Script view, giving it focus. Press Ctrl-A which is the typical Windows
Select-All shortcut. Your code should all be highlighted.
9.
Click in the Script view, giving it focus. Press Ctrl-A which is the typical Windows
Select-All shortcut. Your code should all be highlighted.
Lab 4 - 3
11. Click the Comment icon on the PainterBar. Every statement is now commented. The
window will no longer work as before.
11. Click the Comment icon on the PainterBar. Every statement is now commented. The
window will no longer work as before.
12. Using the Script views first drop down, change to w_claim_calculator and then use
the Event list drop down to navigate back to your new ue_calculate event. The Event
list is alphabetical in order, and only coded events display at the top of the list. Your
ue_calculate will be at the bottom of the Event list.
12. Using the Script views first drop down, change to w_claim_calculator and then use
the Event list drop down to navigate back to your new ue_calculate event. The Event
list is alphabetical in order, and only coded events display at the top of the list. Your
ue_calculate will be at the bottom of the Event list.
14. A good rule of thumb to remember: Save early, save often. Press Ctrl+S to save any
PowerBuilder object. Remember, that saving also causes a compile, so you are
performing two important tasks.
14. A good rule of thumb to remember: Save early, save often. Press Ctrl+S to save any
PowerBuilder object. Remember, that saving also causes a compile, so you are
performing two important tasks.
15. Un-mapped user events are like functions. The developer is responsible for calling
them when appropriate. From where will you call this new event?
15. Un-mapped user events are like functions. The developer is responsible for calling
them when appropriate. From where will you call this new event?
_____________________________________________________________________
16. In your Student Guide, Module 4, review your options for calling methods in
PowerBuilder. There are two syntaxes you could use to call the new event.
16. In your Student Guide, Module 4, review your options for calling methods in
PowerBuilder. There are two syntaxes you could use to call the new event.
18. At the top of this event, before the commented code, trigger ue_calculate using the
following:
18. At the top of this event, before the commented code, trigger ue_calculate using the
following:
parent.event ue_calculate( )
parent.event ue_calculate( )
OR
OR
parent.triggerevent(ue_calculate)
parent.triggerevent(ue_calculate)
19. Always think generic. Use your PowerBuilder pronouns wherever possible. It is
simply good practice.
19. Always think generic. Use your PowerBuilder pronouns wherever possible. It is
simply good practice.
20. Save and test making sure you are still calculating an amount paid.
20. Save and test making sure you are still calculating an amount paid.
Lab 4 - 4
_____________________________________________________________________
1.
As an alternative to un-mapped user events, you will now put your logic into an object
function on the window and then write code to trigger the function when appropriate.
1.
As an alternative to un-mapped user events, you will now put your logic into an object
function on the window and then write code to trigger the function when appropriate.
2.
2.
3.
Using the PowerBuilder menu bar, click InsertFunction. You will be placed in the
Function painter.
3.
Using the PowerBuilder menu bar, click InsertFunction. You will be placed in the
Function painter.
4.
Notice the prototype area of a function differs from an event. Events can only be
public, object functions can be public (default), private or protected. There is also no
Event ID drop down. The rest is the same.
4.
Notice the prototype area of a function differs from an event. Events can only be
public, object functions can be public (default), private or protected. There is also no
Event ID drop down. The rest is the same.
5.
While public is the default, good object-oriented programmers wont always use that
option. You do not always need to expose your object logic to the outside world
(other objects). Change the Access to private. Only the claim calculator window can
call this function.
5.
While public is the default, good object-oriented programmers wont always use that
option. You do not always need to expose your object logic to the outside world
(other objects). Change the Access to private. Only the claim calculator window can
call this function.
Lab 4 - 4
6.
Change the return type of this function to double (to match our code). Press tab.
6.
Change the return type of this function to double (to match our code). Press tab.
7.
Object functions should have the of_ prefix. Name this function of_calculate. Press
tab.
7.
Object functions should have the of_ prefix. Name this function of_calculate. Press
tab.
8.
8.
double
string
adbl_claim_amt
as_claim_type
double
string
(Be sure after you type the last argument name that you either press tab or enter. If
you tab, do not worry about the addition of a new argument line. It will be ignored.)
9.
(Be sure after you type the last argument name that you either press tab or enter. If
you tab, do not worry about the addition of a new argument line. It will be ignored.)
9.
adbl_claim_amt
as_claim_type
11. As far as PowerBuilder is concerned, the function is complete. Save your work.
11. As far as PowerBuilder is concerned, the function is complete. Save your work.
12. Using the first drop down in the Function painter, navigate back to
w_claim_calculator. You should be positioned back on ue_calculate.
12. Using the first drop down in the Function painter, navigate back to
w_claim_calculator. You should be positioned back on ue_calculate.
13. Click in the Script view of ue_calculate, press Ctrl+A and then Ctrl+C to copy that
code to the clipboard.
13. Click in the Script view of ue_calculate, press Ctrl+A and then Ctrl+C to copy that
code to the clipboard.
14. Navigate back to your of_calculate function and paste the code before your return
statement.
14. Navigate back to your of_calculate function and paste the code before your return
statement.
a. em_amount.getdata()
a. em_amount.getdata()
b. ls_claim_type = ddlb_claimtype.text
b. ls_claim_type = ddlb_claimtype.text
c. em_paid.text =
c. em_paid.text =
Lab 4 - 5
Lab 4 - 5
Lab 4 - 6
16. We need to cut them (to the clipboard, Ctrl-X) and then paste them back into cb_tests
Clicked event, but we cant do that until the function is ready to compile. Since the
lines arent all together in the code, you will have to be creative. Use the
PowerBuilder File Editor as a temporary pasting area.
16. We need to cut them (to the clipboard, Ctrl-X) and then paste them back into cb_tests
Clicked event, but we cant do that until the function is ready to compile. Since the
lines arent all together in the code, you will have to be creative. Use the
PowerBuilder File Editor as a temporary pasting area.
17. Delete the statement declaring ls_claim_type. The function defined the claim type as
an argument. Function arguments become local variables usable within the function.
Change any statements in the code that used ls_claim_type to as_claim_type.
17. Delete the statement declaring ls_claim_type. The function defined the claim type as
an argument. Function arguments become local variables usable within the function.
Change any statements in the code that used ls_claim_type to as_claim_type.
18. Delete the declaration of ldbl_claim_amt and change any code references to use the
argument adbl_claim_amt. Any Script view, including the Function painter has a
Search and Replace feature (there is a Replace icon on the PainterBar or you can use
the Ctrl+H shortcut.).
18. Delete the declaration of ldbl_claim_amt and change any code references to use the
argument adbl_claim_amt. Any Script view, including the Function painter has a
Search and Replace feature (there is a Replace icon on the PainterBar or you can use
the Ctrl+H shortcut.).
19. Delete the declaration of ldbl_ret and change the Return statement to return
ldbl_amt_paid.
19. Delete the declaration of ldbl_ret and change the Return statement to return
ldbl_amt_paid.
Lab 4 - 6
double
string
ldbl_claim_amt, ldbl_amt_paid
ls_claim_type
double
string
25. Switch to the File Editor and cut the three lines of code we pasted there earlier into
your function, after the above declarations.
Lab 4 - 7
ldbl_claim_amt, ldbl_amt_paid
ls_claim_type
25. Switch to the File Editor and cut the three lines of code we pasted there earlier into
your function, after the above declarations.
Lab 4 - 7
Lab 4 - 8
26. Before the statement that writes back to em_paid, call your function, catching the
return in the ldbl_amt_paid variable. Sample cb_test Clicked event code follows:
26. Before the statement that writes back to em_paid, call your function, catching the
return in the ldbl_amt_paid variable. Sample cb_test Clicked event code follows:
27. Save and test. After successfully testing, close any open painters.
27. Save and test. After successfully testing, close any open painters.
29. Begin by examining the event list. Which event fires when a fatal application error
has occurred?
29. Begin by examining the event list. Which event fires when a fatal application error
has occurred?
_____________________________________________________________________
_____________________________________________________________________
30. Look at the Application objects Properties view. Click the Additional Properties
button. What object is automatically populated with information when an application
experiences a runtime problem?
30. Look at the Application objects Properties view. Click the Additional Properties
button. What object is automatically populated with information when an application
experiences a runtime problem?
_____________________________________________________________________
_____________________________________________________________________
31. Open the Browser (ToolsBrowser). Click the System tab. Click the Error object in
the left-hand list. Then double click Properties in the right-hand list.
31. Open the Browser (ToolsBrowser). Click the System tab. Click the Error object in
the left-hand list. Then double click Properties in the right-hand list.
Lab 4 - 8
33. When a runtime error occurs, the global Error objects properties are automatically
populated with details about the error (number, text), and where the error occurred
(object, objectevent and line).
33. When a runtime error occurs, the global Error objects properties are automatically
populated with details about the error (number, text), and where the error occurred
(object, objectevent and line).
35. Create an object function on the a_sybhealth Application object to be called when the
SystemError event fires by clicking InsertFunction on the PowerBuilder menu bar.
35. Create an object function on the a_sybhealth Application object to be called when the
SystemError event fires by clicking InsertFunction on the PowerBuilder menu bar.
36. If not explicitly stated, take defaults when performing lab steps. Set the function to
return (None). Dont forget the parenthesis around the word None.
36. If not explicitly stated, take defaults when performing lab steps. Set the function to
return (None). Dont forget the parenthesis around the word None.
37. Name the function of_report_error. You do not need to define any arguments for this
function.
37. Name the function of_report_error. You do not need to define any arguments for this
function.
38. The function will display the fatal error information in a MessageBox, and ask the
user if they wish to save the information to a file as well. You will be concatenating
the values of the Error properties into a string for displaying and writing that string
out to a file. Some notes to help you with this task:
38. The function will display the fatal error information in a MessageBox, and ask the
user if they wish to save the information to a file as well. You will be concatenating
the values of the Error properties into a string for displaying and writing that string
out to a file. Some notes to help you with this task:
d. Some properties are numeric and will need to be casted to a string for
displaying and writing to the file.
d. Some properties are numeric and will need to be casted to a string for
displaying and writing to the file.
e. Use the tilde characters to place each piece of error information in a separate
line. Put descriptions on the information.
e. Use the tilde characters to place each piece of error information in a separate
line. Put descriptions on the information.
f.
f.
Write the error information out to the same directory as the application (in
your case, the Student directory) with a file name of SybHealth_error.log.
h. Open the file in append mode so error messages are kept. But append a blank
line (or some form of separator) between errors that get written.
2010 Sybase, Inc.
Write the error information out to the same directory as the application (in
your case, the Student directory) with a file name of SybHealth_error.log.
Lab 4 - 9
h. Open the file in append mode so error messages are kept. But append a blank
line (or some form of separator) between errors that get written.
2010 Sybase, Inc.
Lab 4 - 9
Lab 4 - 10
Lab 4 - 10
41. Navigate to the a_sybhealth SystemError event. Call the function from the event as
follows:
41. Navigate to the a_sybhealth SystemError event. Call the function from the event as
follows:
this.of_report_error( )
this.of_report_error( )
42. Add a HALT CLOSE after the function call in the SystemError event. HALT alone
terminates a running PowerBuilder application. HALT CLOSE does the same; it just
fires the Application objects Close event first, giving the application a chance to
clean up before terminating.
42. Add a HALT CLOSE after the function call in the SystemError event. HALT alone
terminates a running PowerBuilder application. HALT CLOSE does the same; it just
fires the Application objects Close event first, giving the application a chance to
clean up before terminating.
44. Test your work, simulating a fatal error by coding a divide by zero in the Application
objects Open event:
44. Test your work, simulating a fatal error by coding a divide by zero in the Application
objects Open event:
45. To run the application you need to right-click over the SybHealth_target in the
System Tree and select Run from the context menu. This will cause the entire
application to run as opposed to Run/Preview we have been doing to run a single
window. Remember, we have enabled Just In Time Debugging in an earlier lab.
When prompted, click the Ignore button, but you will be placed into the Debugger.
Your message box from the function may be hidden behind some open windows.
Check your error log file to make sure you wrote information there.
45. To run the application you need to right-click over the SybHealth_target in the
System Tree and select Run from the context menu. This will cause the entire
application to run as opposed to Run/Preview we have been doing to run a single
window. Remember, we have enabled Just In Time Debugging in an earlier lab.
When prompted, click the Ignore button, but you will be placed into the Debugger.
Your message box from the function may be hidden behind some open windows.
Check your error log file to make sure you wrote information there.
46. When satisfied with your work, take the divide by zero code out of the Application
objects Open event, leaving it empty for now.
46. When satisfied with your work, take the divide by zero code out of the Application
objects Open event, leaving it empty for now.
Lab 4 - 11
Lab 4 - 11
1.
To provide another alternative to un-mapped events and object functions, you will
now put your logic into a global function.
1.
To provide another alternative to un-mapped events and object functions, you will
now put your logic into a global function.
2.
Using the System Tree, right-click over your SybHealth_target and select New
from the context menu.
2.
Using the System Tree, right-click over your SybHealth_target and select New
from the context menu.
3.
3.
4.
What does the (Global) Function painter should look like the object-function or event
painter.
4.
What does the (Global) Function painter should look like the object-function or event
painter.
5.
How are Global functions similar to un-mapped user events? How do they differ
from object functions?
5.
How are Global functions similar to un-mapped user events? How do they differ
from object functions?
6.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Name the function f_calculate, creating the global functions prototype the same way
you did the object function, returning a double and with the same two arguments:
double
string
6.
adbl_claim_amt
as_claim_type
double
string
adbl_claim_amt
as_claim_type
7.
7.
8.
8.
9.
9.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
ac_cover_type
character
13. After adding the argument to the function, make the appropriate changes to your code.
A solution can be seen on the next page:
Lab 4 - 12
Name the function f_calculate, creating the global functions prototype the same way
you did the object function, returning a double and with the same two arguments:
ac_cover_type
13. After adding the argument to the function, make the appropriate changes to your code.
A solution can be seen on the next page:
Lab 4 - 12
14. Save. When saving a global function, you are prompted again to name your function
and select which PBL you wish to put the function into. Choose the claims.pbl. If
you forget and put an object in the wrong PBL, you can always Move objects by
right-clicking over them in the System Tree.
14. Save. When saving a global function, you are prompted again to name your function
and select which PBL you wish to put the function into. Choose the claims.pbl. If
you forget and put an object in the wrong PBL, you can always Move objects by
right-clicking over them in the System Tree.
17. Can you see your object function or your user event (ue_calculate) in the System
Tree?
17. Can you see your object function or your user event (ue_calculate) in the System
Tree?
_____________________________________________________________________
_____________________________________________________________________
Lab 4 - 13
19. Expand the Events and/or Functions folders to answer the above question.
Remember, the icons look different if an event or function is coded. Using the
System Tree, double-click either of_calculate or ue_calculate and it should open in
the painter taking you directly to your code (a new feature available since
PowerBuilder 11).
19. Expand the Events and/or Functions folders to answer the above question.
Remember, the icons look different if an event or function is coded. Using the
System Tree, double-click either of_calculate or ue_calculate and it should open in
the painter taking you directly to your code (a new feature available since
PowerBuilder 11).
20. This was an exercise in creating global functions. You do not need to call the
function from the claim calculator window. Remember that if you have a global
function, it can be called from anywhere in the application. If you use an object
function instead, a) the object has to be instantiated before you call the function and b)
you can limit access to the object level functions.
20. This was an exercise in creating global functions. You do not need to call the
function from the claim calculator window. Remember that if you have a global
function, it can be called from anywhere in the application. If you use an object
function instead, a) the object has to be instantiated before you call the function and b)
you can limit access to the object level functions.
1.
External functions are those written in another language, like C++, but are accessible
from your PowerScript objects and their events or functions. Why re-invent the wheel
when you can call work provided by others? The most common examples of using
External Functions are to call Windows API functions.
1.
External functions are those written in another language, like C++, but are accessible
from your PowerScript objects and their events or functions. Why re-invent the wheel
when you can call work provided by others? The most common examples of using
External Functions are to call Windows API functions.
2.
Some useful documents for defining and using External Functions can be found on
the Sybase web site. Go to www.sybase.com and search for PowerBuilder and
Windows API. Look for the documents named 32-bit Windows API Calls for
PowerBuilder and Prototyping API Calls for PowerBuilder.
2.
Some useful documents for defining and using External Functions can be found on
the Sybase web site. Go to www.sybase.com and search for PowerBuilder and
Windows API. Look for the documents named 32-bit Windows API Calls for
PowerBuilder and Prototyping API Calls for PowerBuilder.
3.
3.
4.
Click the Declare Instance Variables tab in the Window painter (lower, middle of the
painter).
4.
Click the Declare Instance Variables tab in the Window painter (lower, middle of the
painter).
5.
Using the middle drop down, change to Global External Functions. Declare the
external function as follows:
5.
Using the middle drop down, change to Global External Functions. Declare the
external function as follows:
(If using PowerBuilder 9 or earlier do not add the alias for clause to the declaration.)
Lab 4 - 14
(If using PowerBuilder 9 or earlier do not add the alias for clause to the declaration.)
6.
The above example was found in the document named 32-bit Windows API Calls
for PowerBuilder. GetUserNameA( ) is a Windows function that will return the
name of the user who is currently logged into the Operating System.
6.
The above example was found in the document named 32-bit Windows API Calls
for PowerBuilder. GetUserNameA( ) is a Windows function that will return the
name of the user who is currently logged into the Operating System.
7.
7.
8.
8.
9.
Write code to call the GetUserNameA function and write the returned value to the
Claim Calculators Title property, in addition to the value already in the title. A
solution to this step can be found on the next page:
9.
Write code to call the GetUserNameA function and write the returned value to the
Claim Calculators Title property, in addition to the value already in the title. A
solution to this step can be found on the next page:
Lab 4 - 14
10. Save and Run/Preview the claim calculator window to test your work. You may
need to resize the window to see more information in the title bar.
10. Save and Run/Preview the claim calculator window to test your work. You may
need to resize the window to see more information in the title bar.
11. Close any open painters when you have completed your testing.
11. Close any open painters when you have completed your testing.
1.
This task has you using the PowerBuilder Debugger. We will use the claim calculator
to learn how to use this utility.
1.
This task has you using the PowerBuilder Debugger. We will use the claim calculator
to learn how to use this utility.
2.
To debug, you will need to run the application in its entirety, which you are not yet set
up to do.
2.
To debug, you will need to run the application in its entirety, which you are not yet set
up to do.
3.
3.
4.
4.
5.
5.
Open(w_claim_calculator)
Open(w_claim_calculator)
6.
6.
7.
7.
8.
On the drop down menu, you will see two options: Debug sybhealth_target and
Select and Debug. Your current workspace has two targets. If you needed to debug a
target other than SybHealth_target, you would have to use the Select and Debug
option. Select and Debug displays a dialog letting you select which target you wish to
debug. There are also icons on the PowerBar to accomplish the same task.
8.
On the drop down menu, you will see two options: Debug sybhealth_target and
Select and Debug. Your current workspace has two targets. If you needed to debug a
target other than SybHealth_target, you would have to use the Select and Debug
option. Select and Debug displays a dialog letting you select which target you wish to
debug. There are also icons on the PowerBar to accomplish the same task.
9.
9.
11. In the upper-right of the Debugger is a view named the Source Browser. It has a tree
view containing the generic PowerBuilder object types. Expand Windows.
11. In the upper-right of the Debugger is a view named the Source Browser. It has a tree
view containing the generic PowerBuilder object types. Expand Windows.
Lab 4 - 15
Lab 4 - 15
Lab 4 - 16
14. The Source Browser only shows events that have been coded, simplifying the setup of
the Debugger. Double-click on the clicked( ) event of cb_test.
14. The Source Browser only shows events that have been coded, simplifying the setup of
the Debugger. Double-click on the clicked( ) event of cb_test.
15. The Clicked event code is now displaying in the upper right view of the Debugger.
You are now ready to set a breakpoint. You can set as many breakpoints as you need,
but for this exercise, keep things simple.
15. The Clicked event code is now displaying in the upper right view of the Debugger.
You are now ready to set a breakpoint. You can set as many breakpoints as you need,
but for this exercise, keep things simple.
16. Double-click on the statement where you are getting the data from the em_amount
EditMask. Double clicking will result in a red dot being placed to the left of the code.
This is a breakpoint. When you come into the debugger, you should have some idea
of where the application is breaking and set breakpoints accordingly.
16. Double-click on the statement where you are getting the data from the em_amount
EditMask. Double clicking will result in a red dot being placed to the left of the code.
This is a breakpoint. When you come into the debugger, you should have some idea
of where the application is breaking and set breakpoints accordingly.
17. On the menu, click DebugStart sybhealth_target, or click the first icon on the
PainterBar.
17. On the menu, click DebugStart sybhealth_target, or click the first icon on the
PainterBar.
18. The window will appear to be running as normal until you hit a breakpoint.
18. The window will appear to be running as normal until you hit a breakpoint.
19. Enter a claim amount of 100.00 and a type of HSPTL. Click the Calculate button.
The window disappears and you are back in the Debugger.
19. Enter a claim amount of 100.00 and a type of HSPTL. Click the Calculate button.
The window disappears and you are back in the Debugger.
Lab 4 - 16
20. You will see a yellow arrow over the breakpoint indicator (red dot). Code execution
has been suspended, awaiting your input.
20. You will see a yellow arrow over the breakpoint indicator (red dot). Code execution
has been suspended, awaiting your input.
21. If not selected, click the Local tab (middle of Debugger), where you will see the
values of any declared local variables.
21. If not selected, click the Local tab (middle of Debugger), where you will see the
values of any declared local variables.
22. Press the F8 (Step) key one time. The yellow arrow moves to the next statement and
the value of the ldb_claim_amt local variable has been updated.
22. Press the F8 (Step) key one time. The yellow arrow moves to the next statement and
the value of the ldb_claim_amt local variable has been updated.
23. Double-click the ldb_claim_amt variable in the Debugger. A dialog opens, allowing
you to change the value. Change the value to 200 and click OK.
23. Double-click the ldb_claim_amt variable in the Debugger. A dialog opens, allowing
you to change the value. Change the value to 200 and click OK.
Lab 4 - 17
Lab 4 - 17
Lab 4 - 18
25. When in the Debugger, it is always helpful to watch the title bars. In the upper-left
view (where the code displays), you should now see that you have entered the code
for your of_calculate( ) function you wrote earlier.
25. When in the Debugger, it is always helpful to watch the title bars. In the upper-left
view (where the code displays), you should now see that you have entered the code
for your of_calculate( ) function you wrote earlier.
26. You can continue to F8 to step thru code until you have found what you are looking
for in the Debugger. You could also choose to Step Out (Shift-F8) the of_calculate( )
function if you dont need to walk the code there. There is also a Step Over (F10) that
you could use to have totally avoided the function altogether.
26. You can continue to F8 to step thru code until you have found what you are looking
for in the Debugger. You could also choose to Step Out (Shift-F8) the of_calculate( )
function if you dont need to walk the code there. There is also a Step Over (F10) that
you could use to have totally avoided the function altogether.
27. Spend a few minutes exploring the Debugger. You may have to start and stop the
Debugger to explore fully.
27. Spend a few minutes exploring the Debugger. You may have to start and stop the
Debugger to explore fully.
Lab 4 - 18
Objectives:
Objectives:
Description:
In this lab, you will begin by evaluating the provided mini-framework objects (added to
the SybHealth target Library List in the lab for Module 2). You will then add, through
inheritance, some new framework windows that will be coded later, as you learn additional
concepts. To get some additional practice adding methods to classes, you will put some
stub methods into the framework windows no code just the declaration of the
methods. These methods will be coded in later labs. Last, you will create your own
Standard Visual User Object(s) to augment the mini-framework provided.
Description:
In this lab, you will begin by evaluating the provided mini-framework objects (added to
the SybHealth target Library List in the lab for Module 2). You will then add, through
inheritance, some new framework windows that will be coded later, as you learn additional
concepts. To get some additional practice adding methods to classes, you will put some
stub methods into the framework windows no code just the declaration of the
methods. These methods will be coded in later labs. Last, you will create your own
Standard Visual User Object(s) to augment the mini-framework provided.
Task Outline:
Task Outline:
Lab 5 - 1
Lab 5 - 1
Lab Workbook
Lab Workbook
Detailed Instructions
Detailed Instructions
Lab 5 - 2
1. This task has you gain a better understanding of the contents of the four framework
PBLs you added in the lab for Module 2 (windows_base, windows_abstract,
visual_controls_base, visual_controls_abstract).
1. This task has you gain a better understanding of the contents of the four framework
PBLs you added in the lab for Module 2 (windows_base, windows_abstract,
visual_controls_base, visual_controls_abstract).
2. Expand and review the contents of the windows_base and windows_abstract PBLs.
2. Expand and review the contents of the windows_base and windows_abstract PBLs.
3. w_master is the top-most ancestor of the hierarchy. Every window you create will
ultimately inherit from w_master. Why have one window that every window
ultimately inherits from?
3. w_master is the top-most ancestor of the hierarchy. Every window you create will
ultimately inherit from w_master. Why have one window that every window
ultimately inherits from?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
5. In a null area of the left-hand list, right-click and select Show Hierarchy from the
context menu:
5. In a null area of the left-hand list, right-click and select Show Hierarchy from the
context menu:
Lab 5 - 2
6. The Browser is now showing the windows in hierarchical order. You may have to
expand w_master to see the descendant objects. The Window tree view does not
show a plus symbol beside objects that can be expanded:
6. The Browser is now showing the windows in hierarchical order. You may have to
expand w_master to see the descendant objects. The Window tree view does not
show a plus symbol beside objects that can be expanded:
7. There was a reason for the window names provided. Those names indicate what?
7. There was a reason for the window names provided. Those names indicate what?
_____________________________________________________________________
8. Close the Browser.
9. Open w_child in the Window painter. Navigate to the Properties view. Check the
Window type property.
9. Open w_child in the Window painter. Navigate to the Properties view. Check the
Window type property.
10. Repeat step 9 opening w_popup and reviewing its Window type property.
10. Repeat step 9 opening w_popup and reviewing its Window type property.
12. The provided framework windows are referred to as a hierarchy-by-type (for Window
type).
12. The provided framework windows are referred to as a hierarchy-by-type (for Window
type).
13. There is no code in any of the framework objects. They were given to you as a starting
point.
13. There is no code in any of the framework objects. They were given to you as a starting
point.
_____________________________________________________________________
2. For example, if you had identified a pattern where you had many windows that either
display or manipulate data, you probably need a window that has a DataWindow
control on it. Rather than constantly having to drag a DataWindow control to a new
window, do it one time in an ancestor object.
2. For example, if you had identified a pattern where you had many windows that either
display or manipulate data, you probably need a window that has a DataWindow
control on it. Rather than constantly having to drag a DataWindow control to a new
window, do it one time in an ancestor object.
Lab 5 - 3
Lab 5 - 3
Lab Workbook
Lab 5 - 4
Lab Workbook
3. Another common example (pattern) is the Master-Detail. In a Master-Detail, you have
two DataWindow controls on a single window. Anywhere you identify a pattern; you
should ask yourself should this be put in my framework?
4. Using the System Tree, right-click over w_main and select Inherit from on the context
menu. A new untitled window appears in the Window painter.
4. Using the System Tree, right-click over w_main and select Inherit from on the context
menu. A new untitled window appears in the Window painter.
5. Save this window as w_sheet in the windows_abstract.pbl. You will have to click
FileSave As since no changes have been made. This will be the ancestor of all
sheets in our MDI (Multiple Document Interface) application. You will be learning
more about MDI and sheets in the next module.
5. Save this window as w_sheet in the windows_abstract.pbl. You will have to click
FileSave As since no changes have been made. This will be the ancestor of all
sheets in our MDI (Multiple Document Interface) application. You will be learning
more about MDI and sheets in the next module.
7. Using the System Tree, inherit from w_sheet., creating w_data_sheet. Save this
window in the windows_abstract.pbl. Controls will be put on this window later in this
lab.
7. Using the System Tree, inherit from w_sheet., creating w_data_sheet. Save this
window in the windows_abstract.pbl. Controls will be put on this window later in this
lab.
9. Again, inherit from w_sheet, creating w_master_detail_sheet. Save this window in the
windows_abstract.pbl.
9. Again, inherit from w_sheet, creating w_master_detail_sheet. Save this window in the
windows_abstract.pbl.
11. Use the Browser to ensure you have the following hierarchy:
11. Use the Browser to ensure you have the following hierarchy:
Lab 5 - 4
1. Many tasks are repetitive within one or many applications. Try to avoid coding the
same thing multiple times. If you create method signatures (prototypes) in your
framework, you wont have to constantly repeat that step. Some times you will just
define the method signature in the framework object, and then override the method in
the descendant object(s). Some times you will put code in the ancestor. These are
design decisions.
1. Many tasks are repetitive within one or many applications. Try to avoid coding the
same thing multiple times. If you create method signatures (prototypes) in your
framework, you wont have to constantly repeat that step. Some times you will just
define the method signature in the framework object, and then override the method in
the descendant object(s). Some times you will put code in the ancestor. These are
design decisions.
2. Name some common tasks that will be invoked by an end-user who is working with a
window (especially windows that allow data and/or data manipulations):
2. Name some common tasks that will be invoked by an end-user who is working with a
window (especially windows that allow data and/or data manipulations):
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
5. The decision to make your methods functions or events is also a design issue. This
needs to be a thought-out before you arbitrarily create methods. A good rule of thumb
is if it is initiated by an end-user, it is an event. If it is something the system initiates
internally, it is a function. But you need to also remember that only functions can be
overloaded. Only functions allow you to set an access privilege such as Private or
Protected. Review Module 4 for more details about choosing events or functions.
5. The decision to make your methods functions or events is also a design issue. This
needs to be a thought-out before you arbitrarily create methods. A good rule of thumb
is if it is initiated by an end-user, it is an event. If it is something the system initiates
internally, it is a function. But you need to also remember that only functions can be
overloaded. Only functions allow you to set an access privilege such as Private or
Protected. Review Module 4 for more details about choosing events or functions.
Lab 5 - 5
Lab 5 - 5
Lab Workbook
Lab Workbook
7. Add the following new user events (un-mapped). All of these events return (None)
and have no arguments:
7. Add the following new user events (un-mapped). All of these events return (None)
and have no arguments:
ue_print( )
ue_save( )
ue_print( )
ue_save( )
An example follows:
An example follows:
8. Add the following new user events (un-mapped). These events return a long and have
one integer argument named as seen below:
8. Add the following new user events (un-mapped). These events return a long and have
one integer argument named as seen below:
An example follows:
An example follows:
10. Because of inheritance, descendants will inherit any non-private members of their
ancestors.
10. Because of inheritance, descendants will inherit any non-private members of their
ancestors.
11. Open w_data_sheet and verify the existence of the four new events.
Lab 5 - 6
11. Open w_data_sheet and verify the existence of the four new events.
2010 Sybase, Inc.
Lab 5 - 6
13. Verify existence of the four events on w_master_detail_sheet. You have reduced the
amount of effort necessary by half because of inheritance. Remember, code will be
added later, as we learn new concepts and techniques.
13. Verify existence of the four events on w_master_detail_sheet. You have reduced the
amount of effort necessary by half because of inheritance. Remember, code will be
added later, as we learn new concepts and techniques.
14. Before closing the Window painter, select Tools-Keyboard Shortcuts from the menu
and then add the following shortcuts:
14. Before closing the Window painter, select Tools-Keyboard Shortcuts from the menu
and then add the following shortcuts:
19. You will want to commit to memory some of the default shortcuts under Additional
Painter Shortcuts. While you will not immediately understand their use, as we start
into modules where coding is involved, you will use these many times. Good
shortcuts to remember are:
19. You will want to commit to memory some of the default shortcuts under Additional
Painter Shortcuts. While you will not immediately understand their use, as we start
into modules where coding is involved, you will use these many times. Good
shortcuts to remember are:
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
4. We provided some SVUOs in the mini-framework to save time and allow us to teach
you more concepts. We have already created User Object versions of common
Window controls like SingleLineEdit (u_sle), Radio Button (u_rb), CommandButton
(u_cb), etc.
4. We provided some SVUOs in the mini-framework to save time and allow us to teach
you more concepts. We have already created User Object versions of common
Window controls like SingleLineEdit (u_sle), Radio Button (u_rb), CommandButton
(u_cb), etc.
6. Right-click over the SybHealth_target in the System Tree and select New from the
context menu.
6. Right-click over the SybHealth_target in the System Tree and select New from the
context menu.
7. On the PB Object tab, select Standard Visual and then click OK.
7. On the PB Object tab, select Standard Visual and then click OK.
Lab 5 - 7
Lab 5 - 7
Lab Workbook
Lab Workbook
9. You have just inherited from the PowerBuilder System Class DataWindow control, as
the title bar of the User Object painter indicates.
9. You have just inherited from the PowerBuilder System Class DataWindow control, as
the title bar of the User Object painter indicates.
10. Enable the HScrollBar and VScrollBar properties of the DataWindow control.
10. Enable the HScrollBar and VScrollBar properties of the DataWindow control.
11. On the Other property tab, set the Width to 2000 and Height to 1000.
11. On the Other property tab, set the Width to 2000 and Height to 1000.
12. Navigate to the Declare Instance Variables tab where we will add some custom
properties:
12. Navigate to the Declare Instance Variables tab where we will add some custom
properties:
Boolean
Boolean
Lab 5 - 8
ib_single_select
ib_multi_select
Boolean
Boolean
ib_single_select
ib_multi_select
15. Drag the u_dw from the System Tree on top of the w_data_sheet (on the Layout).
Resize the DataWindow so that it occupies the majority of the window. In the
Properties view, name the DataWindow control dw_data.
15. Drag the u_dw from the System Tree on top of the w_data_sheet (on the Layout).
Resize the DataWindow so that it occupies the majority of the window. In the
Properties view, name the DataWindow control dw_data.
Lab 5 - 8
20. While one of the DataWindow controls has focus, check the Properties view, General
tab (scroll to the bottom) and you should see your two custom properties,
ib_single_select and ib_multi_select.
20. While one of the DataWindow controls has focus, check the Properties view, General
tab (scroll to the bottom) and you should see your two custom properties,
ib_single_select and ib_multi_select.
22. Allowing the user to choose where the toolbars display is a common feature. We have
created the window already. All you have to do is import it.
22. Allowing the user to choose where the toolbars display is a common feature. We have
created the window already. All you have to do is import it.
23. In the System Tree, right-click over the sybhealth.pbl and select Import
23. In the System Tree, right-click over the sybhealth.pbl and select Import
Lab 5 - 9
Lab 5 - 9
Lab Workbook
Lab Workbook
Objectives:
Objectives:
Description:
In this lab, you will be creating two of the basic windows for the SybHealth application
Login and About. In order to reinforce some of the concepts taught in earlier modules, you
will be asked to have the Login window read and display values from an INI file. You will
also be dynamically setting property values of controls on the Login window. Then, you
will, by using the Timer( ) function and event, set the About window so that it remains
open only for 10 seconds, then automatically closes itself.
Description:
In this lab, you will be creating two of the basic windows for the SybHealth application
Login and About. In order to reinforce some of the concepts taught in earlier modules, you
will be asked to have the Login window read and display values from an INI file. You will
also be dynamically setting property values of controls on the Login window. Then, you
will, by using the Timer( ) function and event, set the About window so that it remains
open only for 10 seconds, then automatically closes itself.
Task Outline:
Task Outline:
Lab 5 - 10
Lab 5 - 10
Detailed Instructions
Detailed Instructions
1. Using the System Tree, locate the w_response window (windows_abstract.pbl), rightclick over it, and select Inherit from on the context menu.
1. Using the System Tree, locate the w_response window (windows_abstract.pbl), rightclick over it, and select Inherit from on the context menu.
5. While the User Name static text control still has focus, press Ctrl-T (duplicate). Give
the second static text control text of &Password:. Repeat for the third, Database:.
5. While the User Name static text control still has focus, press Ctrl-T (duplicate). Give
the second static text control text of &Password:. Repeat for the third, Database:.
6. Size all of the static text controls so they are the same width and align their right edges
to that of the User Name text control. Use the aligning and sizing tool
(FormatAlign) discussed in the module.
6. Size all of the static text controls so they are the same width and align their right edges
to that of the User Name text control. Use the aligning and sizing tool
(FormatAlign) discussed in the module.
8. Drag, from visual_controls_base, a u_sle (SingleLineEdit SVUO) and align to the right
of the User Name static text control. Set the Width property to 1000.
8. Drag, from visual_controls_base, a u_sle (SingleLineEdit SVUO) and align to the right
of the User Name static text control. Set the Width property to 1000.
9. Ctrl-T creating two more copies of u_sle. Align the second to the right of Password
and the third to the right of Database. Name the three u_sles: sle_user, sle_pwd and
sle_db respectively.
9. Ctrl-T creating two more copies of u_sle. Align the second to the right of Password
and the third to the right of Database. Name the three u_sles: sle_user, sle_pwd and
sle_db respectively.
10. Always name your controls. Failure to do so causes confusion when coding. We
didnt have you name the StaticText controls because it is rare to need to code or
identify those controls.
10. Always name your controls. Failure to do so causes confusion when coding. We
didnt have you name the StaticText controls because it is rare to need to code or
identify those controls.
11. Set the Accelerator property of sle_user to u and sle_pwd to p. The user can press
Alt-U or Alt-P to access those controls directly.
11. Set the Accelerator property of sle_user to u and sle_pwd to p. The user can press
Alt-U or Alt-P to access those controls directly.
12. Enable sle_pwds Password property to mask characters typed into that control.
12. Enable sle_pwds Password property to mask characters typed into that control.
Lab 5 - 11
Lab 5 - 11
Lab Workbook
Lab Workbook
13. Disable sle_db and turn off its Border property.
14. From visual_controls_abstract, drag the u_cb_ok and u_cb_cancel into locations as
shown above. Name them cb_ok and cb_cancel respectively. Disable the OK button.
14. From visual_controls_abstract, drag the u_cb_ok and u_cb_cancel into locations as
shown above. Name them cb_ok and cb_cancel respectively. Disable the OK button.
15. From visual_controls_base, drag a u_pb (PictureButton) just to the right of sle_db.
Name this control pb_chg_db and set the PictureName property to DatabaseProfile5!.
Set the PowerTipText property to a value of: Change current database.
15. From visual_controls_base, drag a u_pb (PictureButton) just to the right of sle_db.
Name this control pb_chg_db and set the PictureName property to DatabaseProfile5!.
Set the PowerTipText property to a value of: Change current database.
16. Set the windows Width property to 1965 and the Height to 430.
16. Set the windows Width property to 1965 and the Height to 430.
17. Click FormatTab Order (or the Tab Order icon on the PainterBar). Set the tabs in
the order of: sle_user, sle_pwd, cb_ok, cb_cancel and the remaining controls to a
value of 0 (zero). Remember, a value of 0 does not mean the control is disabled, it
means the user cannot tab there. They can always click a control with a tab stop of 0.
17. Click FormatTab Order (or the Tab Order icon on the PainterBar). Set the tabs in
the order of: sle_user, sle_pwd, cb_ok, cb_cancel and the remaining controls to a
value of 0 (zero). Remember, a value of 0 does not mean the control is disabled, it
means the user cannot tab there. They can always click a control with a tab stop of 0.
18. Click the Preview icon on the PainterBar. Running this Preview would not execute
any code you may have in your windows. Your window should look similar to the
following:
18. Click the Preview icon on the PainterBar. Running this Preview would not execute
any code you may have in your windows. Your window should look similar to the
following:
Lab 5 - 12
1. Using the System Tree, right- click over w_response window (windows_abstract.pbl),
and select Inherit from on the context menu.
1. Using the System Tree, right- click over w_response window (windows_abstract.pbl),
and select Inherit from on the context menu.
Lab 5 - 12
4. To create About, drag from visual_controls_base, a u_p (Picture Control SVUO) to the
upper left of the window. While it still has focus, set its name property to p_logo.
4. To create About, drag from visual_controls_base, a u_p (Picture Control SVUO) to the
upper left of the window. While it still has focus, set its name property to p_logo.
5. Assign the PictureName property by clicking the ellipsis button () and browsing to
your Student directory. Select the healthcare3.jpg. Notice the PictureName property
will contain the fully-qualified directory and name. This is dangerous. Never fullyqualify a resource like a picture, icon, etc. Delete the directory from the PictureName
property, leaving only healthcare3.jpg. PowerBuilder will find the file because it
exists in the same directory you are working in.
5. Assign the PictureName property by clicking the ellipsis button () and browsing to
your Student directory. Select the healthcare3.jpg. Notice the PictureName property
will contain the fully-qualified directory and name. This is dangerous. Never fullyqualify a resource like a picture, icon, etc. Delete the directory from the PictureName
property, leaving only healthcare3.jpg. PowerBuilder will find the file because it
exists in the same directory you are working in.
7. Any time you use a resource (picture, icon, cursor), you should put that resources
location in your resource file. Using the File Editor as we did in Module 2, open the
SybHealth.pbr file and add the following as a new line item:
7. Any time you use a resource (picture, icon, cursor), you should put that resources
location in your resource file. Using the File Editor as we did in Module 2, open the
SybHealth.pbr file and add the following as a new line item:
C:\Sybase Courses\DEV134\Student\healthcare3.jpg
C:\Sybase Courses\DEV134\Student\healthcare3.jpg
8. To the right of the picture control you will drag a u_st. While it has focus, type
SybHealth, Incorporated.
8. To the right of the picture control you will drag a u_st. While it has focus, type
SybHealth, Incorporated.
9. While the static text control still has focus, press Ctrl-T (duplicate). Give the second
static text control text of Patient Management System. Repeat for Version 1.0 and
Copyrighted, DaveCo, Inc.. Make all the static text controls have the same width as
that of Patient Management System. Then align all static text left edges. Use the
aligning and sizing tool where possible. Center-justify their text.
9. While the static text control still has focus, press Ctrl-T (duplicate). Give the second
static text control text of Patient Management System. Repeat for Version 1.0 and
Copyrighted, DaveCo, Inc.. Make all the static text controls have the same width as
that of Patient Management System. Then align all static text left edges. Use the
aligning and sizing tool where possible. Center-justify their text.
11. If using PowerBuilder 11 or greater, set the windows Transparency property to 10,
OpenAnimation to centeranimation!, CloseAnimation to fadeanimation! and
Animation Time to 500.
11. If using PowerBuilder 11 or greater, set the windows Transparency property to 10,
OpenAnimation to centeranimation!, CloseAnimation to fadeanimation! and
Animation Time to 500.
Lab 5 - 13
Lab 5 - 13
Lab Workbook
Lab Workbook
13. Using the System Tree, right-click w_about and Run/Preview. You should see the
following:
13. Using the System Tree, right-click w_about and Run/Preview. You should see the
following:
Lab 5 - 14
1. Recall that you looked at the SybHealth.ini file in the lab for Module 2. Open that file
again using the File Editor.
1. Recall that you looked at the SybHealth.ini file in the lab for Module 2. Open that file
again using the File Editor.
2. You will be reading from the DBMS, LogId, and Database keys in this task and
writing their values to the Login window controls and variables for use later when we
write database connection logic.
2. You will be reading from the DBMS, LogId, and Database keys in this task and
writing their values to the Login window controls and variables for use later when we
write database connection logic.
3. Re-open w_login.
3. Re-open w_login.
4. When you are about to write code, you should always ask yourself two questions. In
what object am I going to put this code, and in what event of that object. Then, use the
script painter to position yourself to that location.
4. When you are about to write code, you should always ask yourself two questions. In
what object am I going to put this code, and in what event of that object. Then, use the
script painter to position yourself to that location.
6. Code the Open to read LogId key from the sybhealth.ini file and write its value to
sle_users Text property.
6. Code the Open to read LogId key from the sybhealth.ini file and write its value to
sle_users Text property.
7. Do the same reading the Database key and writing to sle_dbs Text property.
7. Do the same reading the Database key and writing to sle_dbs Text property.
9. Back in the Open event, read one more time from the DBMS key of the INI file,
placing the returned value into is_dbms.
9. Back in the Open event, read one more time from the DBMS key of the INI file,
placing the returned value into is_dbms.
Lab 5 - 14
11. Using the System Tree, Run/Preview w_login. It should look as follows:
11. Using the System Tree, Run/Preview w_login. It should look as follows:
13. Next, you are going to dynamically set some control properties. Since we are reading
the User Name from the INI file, once the user has entered his password, dynamically
enable the OK button.
13. Next, you are going to dynamically set some control properties. Since we are reading
the User Name from the INI file, once the user has entered his password, dynamically
enable the OK button.
14. You could code the Modified event of sle_pwd, but that would imply that the user
types in his password and then tabs. If the user doesnt tab, the OK button would
remain disabled. Review Lab 3 where you created a mapped user event ue_keydown.
That might be a better solution for this example.
14. You could code the Modified event of sle_pwd, but that would imply that the user
types in his password and then tabs. If the user doesnt tab, the OK button would
remain disabled. Review Lab 3 where you created a mapped user event ue_keydown.
That might be a better solution for this example.
15. In the Script view, navigate to sle_pwd. Add a new User Event named ue_keydown.
Map this event to pbm_keydown.
15. In the Script view, navigate to sle_pwd. Add a new User Event named ue_keydown.
Map this event to pbm_keydown.
18. You saw that the OK button didnt activate until you pressed a key the second time.
18. You saw that the OK button didnt activate until you pressed a key the second time.
20. Create another new event ue_keyup. Map this event to pbm_keyup.
20. Create another new event ue_keyup. Map this event to pbm_keyup.
21. Cut the code from your ue_keydown and paste into ue_keyup.
21. Cut the code from your ue_keydown and paste into ue_keyup.
24. Next script the PictureButton, pb_chg_db. If the user clicks that button, enable the
sle_db control by setting the appropriate property with code and then
programmatically set focus to sle_db. Look up the SetFocus( ) function in WinHelp to
assist with this step. This feature will allow the user to change the database they wish
to connect to.
24. Next script the PictureButton, pb_chg_db. If the user clicks that button, enable the
sle_db control by setting the appropriate property with code and then
programmatically set focus to sle_db. Look up the SetFocus( ) function in WinHelp to
assist with this step. This feature will allow the user to change the database they wish
to connect to.
Lab 5 - 15
Lab 5 - 15
Lab Workbook
Lab 5 - 16
Lab Workbook
27. Have you noticed that when you have SingleLineEdit controls that contain text, when
focus is given to them, the existing text is not highlighted? This makes it difficult
when the user wants to change the text. This one Login window has three
SingleLineEdit controls. Would you want to put the code to highlight existing text in
three places, or just one? Which object will you put this code in?
27. Have you noticed that when you have SingleLineEdit controls that contain text, when
focus is given to them, the existing text is not highlighted? This makes it difficult
when the user wants to change the text. This one Login window has three
SingleLineEdit controls. Would you want to put the code to highlight existing text in
three places, or just one? Which object will you put this code in?
_____________________________________________________________________
_____________________________________________________________________
31. Code this event to highlight any text that is there. Using WinHelp, look up the
SelectText function and the Len function. Remember, in PowerBuilder, we are mainly
one-based, so you will want to select the text starting at position 1 and thru the end
(the length) of the existing text. Be sure to think generic. Use your pronouns.
31. Code this event to highlight any text that is there. Using WinHelp, look up the
SelectText function and the Len function. Remember, in PowerBuilder, we are mainly
one-based, so you will want to select the text starting at position 1 and thru the end
(the length) of the existing text. Be sure to think generic. Use your pronouns.
36. A cancel button will typically close its associated window. Write the code to do so,
again thinking generically.
36. A cancel button will typically close its associated window. Write the code to do so,
again thinking generically.
39. These last few steps have been building up your framework. There is no reason these
objects cant be reused later when you have returned and started working on your own
applications. Bear in mind that you can also re-factor existing applications to use
SVUOs.
39. These last few steps have been building up your framework. There is no reason these
objects cant be reused later when you have returned and started working on your own
applications. Bear in mind that you can also re-factor existing applications to use
SVUOs.
Lab 5 - 16
43. If you used native controls initially, before you created SVUOs, you can always refactor the application. Edit Source and then Replace all occurrences of (for example)
singlelineedit with u_sle. You would want to replace all occurrences, not just those
shown above. But be safe. On the replace dialog, click the Replace button, not the
Replace All.
43. If you used native controls initially, before you created SVUOs, you can always refactor the application. Edit Source and then Replace all occurrences of (for example)
singlelineedit with u_sle. You would want to replace all occurrences, not just those
shown above. But be safe. On the replace dialog, click the Replace button, not the
Replace All.
46. Re-open w_login. You can use FileRecent Objects to quickly re-open objects.
46. Re-open w_login. You can use FileRecent Objects to quickly re-open objects.
48. In the sle_dbs Modified event, add a statement to set ib_chg_db to true.
48. In the sle_dbs Modified event, add a statement to set ib_chg_db to true.
49. Using the SetProfileString( ) function taught in Module 4, code the Clicked event of
the OK button to write back out to the sybhealth.ini file the values entered into
sle_user and sle_db, but only if it changed. After writing to the INI file, close
w_login.
49. Using the SetProfileString( ) function taught in Module 4, code the Clicked event of
the OK button to write back out to the sybhealth.ini file the values entered into
sle_user and sle_db, but only if it changed. After writing to the INI file, close
w_login.
Lab 5 - 17
Lab 5 - 17
Lab Workbook
Lab Workbook
50. A solution follows:
51. Run/Preview to test your work. You will need to run several times to thoroughly test.
Change the user name and database name, making sure those changes are written back
to the INI file. Be sure that after testing, you run to put the LogId back to a value of
SybInsure and the Database back to a value of SybHealth.
51. Run/Preview to test your work. You will need to run several times to thoroughly test.
Change the user name and database name, making sure those changes are written back
to the INI file. Be sure that after testing, you run to put the LogId back to a value of
SybInsure and the Database back to a value of SybHealth.
Lab 5 - 18
1. Re-open w_about.
1. Re-open w_about.
3. Add a statement calling the PowerScript Timer( ) function, passing 10 (seconds) to the
function.
3. Add a statement calling the PowerScript Timer( ) function, passing 10 (seconds) to the
function.
4. This statement starts an internal timer object, that every 10 seconds will fire w_abouts
Timer event. Dont confuse the Timer( ) function with the Timer event. The Timer
event is where you will code what you wish to happen.
4. This statement starts an internal timer object, that every 10 seconds will fire w_abouts
Timer event. Dont confuse the Timer( ) function with the Timer event. The Timer
event is where you will code what you wish to happen.
8. Using Run/Preview, test w_about. Remember to wait 10 seconds before the window
will automatically close itself.
8. Using Run/Preview, test w_about. Remember to wait 10 seconds before the window
will automatically close itself.
9. In the Properties view, disable the Control Menu. Most people associate the Control
Menu with the drop down menu that appears when you click the icon in a windows
upper left corner. The response window has no icon displaying, however.
9. In the Properties view, disable the Control Menu. Most people associate the Control
Menu with the drop down menu that appears when you click the icon in a windows
upper left corner. The response window has no icon displaying, however.
10. Run/Preview the w_about window. What did disabling the Control Menu property do?
10. Run/Preview the w_about window. What did disabling the Control Menu property do?
Lab 5 - 18
Objectives:
Objectives:
Description:
In this lab, you will add some menu classes to your framework. The base menu will
contain typical menu options seen in the majority of applications. From there, you will
inherit and create a menu to be used on your MDI frame window. Unlike Microsoft who
displays all items (though disabled), when the MDI frame is active, we will hide all
irrelevant choices for the frame window. You will also create a menu that will be the
ancestor for all MDI sheets you will open. To gain the experience, we will add a new
menu item to the sheet menu so that you will have seen what it takes to move menu items
in a descendant.
Description:
In this lab, you will add some menu classes to your framework. The base menu will
contain typical menu options seen in the majority of applications. From there, you will
inherit and create a menu to be used on your MDI frame window. Unlike Microsoft who
displays all items (though disabled), when the MDI frame is active, we will hide all
irrelevant choices for the frame window. You will also create a menu that will be the
ancestor for all MDI sheets you will open. To gain the experience, we will add a new
menu item to the sheet menu so that you will have seen what it takes to move menu items
in a descendant.
Task Outline:
Task Outline:
Lab 6 - 1
Lab 6 - 1
Detailed Instructions
Detailed Instructions
1.
Menus are reusable objects, reusable across multiple applications. In order for you to
share menus across multiple applications, it would be best to put them in a separate
PBL (or PBLs), that can be added to the Library List of future applications.
1.
Menus are reusable objects, reusable across multiple applications. In order for you to
share menus across multiple applications, it would be best to put them in a separate
PBL (or PBLs), that can be added to the Library List of future applications.
2.
Create one new PBL to hold your menus. Do so by going to Properties of your
SybHealth_target (via the System Tree). This takes you back to the Library List.
Click the New button and be sure you navigate to your C:\Sybase
Courses\DEV134\Student\Framework directory. Name the new library menus.pbl.
2.
Create one new PBL to hold your menus. Do so by going to Properties of your
SybHealth_target (via the System Tree). This takes you back to the Library List.
Click the New button and be sure you navigate to your C:\Sybase
Courses\DEV134\Student\Framework directory. Name the new library menus.pbl.
3.
3.
Lab 6 - 2
1.
Over your SybHealth_target in the System Tree, right-click and select New from
the context menu.
1.
Over your SybHealth_target in the System Tree, right-click and select New from
the context menu.
2.
On the PB Object tab of the New dialog, select Menu and click OK.
2.
On the PB Object tab of the New dialog, select Menu and click OK.
3.
Locate the Tree view in the Menu painter (where you see untitled0). This is your
work area, where you build your menus.
3.
Locate the Tree view in the Menu painter (where you see untitled0). This is your
work area, where you build your menus.
4.
The view just to the right is called the WYSIWYG menu view. As you build the
menu in the Tree view, you can see what your users will see in the WYSIWYG view.
You could build the menu from the WYSIWYG view, but it is not recommended.
4.
The view just to the right is called the WYSIWYG menu view. As you build the
menu in the Tree view, you can see what your users will see in the WYSIWYG view.
You could build the menu from the WYSIWYG view, but it is not recommended.
5.
The view at the bottom is the typical Script view. Notice this is one painter that does
not have the typical Declare Instance Variables tab. That does not mean you cannot
put Instance Variables on a menu.
5.
The view at the bottom is the typical Script view. Notice this is one painter that does
not have the typical Declare Instance Variables tab. That does not mean you cannot
put Instance Variables on a menu.
6.
In the Script view, click on the first drop down. There you can see the Declare option.
Choosing this option puts you on the Declare Instance Variables view.
6.
In the Script view, click on the first drop down. There you can see the Declare option.
Choosing this option puts you on the Declare Instance Variables view.
7.
Over untitled0 in the Tree view, right-click and select Insert Submenu Item. You are
building the Menu Bar.
7.
Over untitled0 in the Tree view, right-click and select Insert Submenu Item. You are
building the Menu Bar.
8.
Type &File. Press the Tab key (DO NOT PRESS THE ENTER KEY). Tabbing
opens a new menu item without you having to constantly right-click.
8.
Type &File. Press the Tab key (DO NOT PRESS THE ENTER KEY). Tabbing
opens a new menu item without you having to constantly right-click.
9.
9.
11. Type &Help. Now you may press ENTER as this is the last menu item on the Menu
Bar.
11. Type &Help. Now you may press ENTER as this is the last menu item on the Menu
Bar.
Lab 6 - 2
14. Next, you will build the drop down menus, beginning with File. In the Tree view of
the painter, right-click over File and select Insert Submenu Item. Enter the following
items: &New, &Open, &Close, - (A dash is a separator line, allowing you to
logically group menu items within a drop down. Do not enter the quotes.), &Save,
Save &As, - (separator), Page Set&up, Print Pre&view, &Print, -, E&xit.
14. Next, you will build the drop down menus, beginning with File. In the Tree view of
the painter, right-click over File and select Insert Submenu Item. Enter the following
items: &New, &Open, &Close, - (A dash is a separator line, allowing you to
logically group menu items within a drop down. Do not enter the quotes.), &Save,
Save &As, - (separator), Page Set&up, Print Pre&view, &Print, -, E&xit.
15. In the menu items properties, add the following Shortcut keys: Ctrl+F4 for Close,
Ctrl+S for Save, Ctrl+P for Print and Alt+F4 for Exit.
15. In the menu items properties, add the following Shortcut keys: Ctrl+F4 for Close,
Ctrl+S for Save, Ctrl+P for Print and Alt+F4 for Exit.
16. On the Exit menu item, put in Exits the application for the MicroHelp property.
You can add other MicroHelp as time permits.
16. On the Exit menu item, put in Exits the application for the MicroHelp property.
You can add other MicroHelp as time permits.
18. Build the drop down for Edit next with the following items: Cu&t, &Copy, &Paste,
-, &Find, &Go To
18. Build the drop down for Edit next with the following items: Cu&t, &Copy, &Paste,
-, &Find, &Go To
19. Add the following Shortcuts: Ctrl+C for Copy, Ctrl+V for Paste, Ctrl+X for Cut,
Ctrl+F for Find, Ctrl+G for Go To.
19. Add the following Shortcuts: Ctrl+C for Copy, Ctrl+V for Paste, Ctrl+X for Cut,
Ctrl+F for Find, Ctrl+G for Go To.
Lab 6 - 3
Lab 6 - 3
Lab 6 - 4
22. Under Window, add the following: Tile &Vertical, Tile &Horizontal, &Layer,
&Cascade, -, Arrange &Icons, -, Close &All.
22. Under Window, add the following: Tile &Vertical, Tile &Horizontal, &Layer,
&Cascade, -, Arrange &Icons, -, Close &All.
23. Verify:
23. Verify:
24. Under Help, add the following: &SybHealth Help, &Contact Us, -, &About
24. Under Help, add the following: &SybHealth Help, &Contact Us, -, &About
25. Verify:
25. Verify:
27. In the Tree view, go back to FileNew and Insert a submenu item. This will create a
cascaded menu. Name the new item &Claim, followed by a separator, then &Patient
and then P&olicy. The WYSIWYG should now look as follows:
27. In the Tree view, go back to FileNew and Insert a submenu item. This will create a
cascaded menu. Name the new item &Claim, followed by a separator, then &Patient
and then P&olicy. The WYSIWYG should now look as follows:
Lab 6 - 4
28. In the Tree view, go back to FileOpen and Insert a submenu item. This will create
a cascaded menu. Name the new item &Doctors List, followed by a separator, then
Claims &Search, another separator and then &Patient Details, another separator and
then &Reports. The WYSIWYG should now look as follows:
28. In the Tree view, go back to FileOpen and Insert a submenu item. This will create
a cascaded menu. Name the new item &Doctors List, followed by a separator, then
Claims &Search, another separator and then &Patient Details, another separator and
then &Reports. The WYSIWYG should now look as follows:
29. Now, make the menu a contemporary-style menu (PowerBuilder 10.5 and greater).
Select m_master from the Tree view of the Menu painter and then in Properties,
change the Menu Style property.
29. Now, make the menu a contemporary-style menu (PowerBuilder 10.5 and greater).
Select m_master from the Tree view of the Menu painter and then in Properties,
change the Menu Style property.
30. Go back to these individual menu items and put set the following MenuImage values:
Save Save!, Print Print! and Exit Exit!.
30. Go back to these individual menu items and put set the following MenuImage values:
Save Save!, Print Print! and Exit Exit!.
Lab 6 - 5
Lab 6 - 5
Lab 6 - 6
32. Add the following MenuImages under Edit: Find Find!, Go To OutputNext!.
32. Add the following MenuImages under Edit: Find Find!, Go To OutputNext!.
Lab 6 - 6
33. Verify:
33. Verify:
35. Next add toolbar icons to common menu items. Remember, toolbar icons are set on
the menu items Toolbar tab in the Properties view. Below, is a list of menu items
that need icons along with the icon values. Add ToolBarItemText where appropriate
and as time permits:
35. Next add toolbar icons to common menu items. Remember, toolbar icons are set on
the menu items Toolbar tab in the Properties view. Below, is a list of menu items
that need icons along with the icon values. Add ToolBarItemText where appropriate
and as time permits:
a. Save: Save!
a. Save: Save!
b. Exit: Exit!
b. Exit: Exit!
c. Find: Find!
c. Find: Find!
d. Go To: OutputNext!
d. Go To: OutputNext!
36. Notice the order of the toolbar icons in the WYSIWYG view. They are out of order.
The Exit icon should always be last on the toolbar.
36. Notice the order of the toolbar icons in the WYSIWYG view. They are out of order.
The Exit icon should always be last on the toolbar.
37. In the Tree view, click on Exit. On the Toolbar tab of Properties, set the
ToolBarItemOrder to 1. This will put the Exit icon on the end of the toolbar. Also set
the ToolBarItemSpace to 1. This puts a small break between the Exit icon and the
others.
37. In the Tree view, click on Exit. On the Toolbar tab of Properties, set the
ToolBarItemOrder to 1. This will put the Exit icon on the end of the toolbar. Also set
the ToolBarItemSpace to 1. This puts a small break between the Exit icon and the
others.
38. Next, click on the root item, m_master, in the Tree view. On the Properties view,
change the Toolbar Style to a contemporary toolbar.
38. Next, click on the root item, m_master, in the Tree view. On the Properties view,
change the Toolbar Style to a contemporary toolbar.
Lab 6 - 7
Lab 6 - 7
39. Note the differences in the WYSIWYG view between traditional and contemporary
toolbars.
39. Note the differences in the WYSIWYG view between traditional and contemporary
toolbars.
1.
Over m_master in the System Tree, right-click and select Inherit from on the context
menu.
1.
Over m_master in the System Tree, right-click and select Inherit from on the context
menu.
2.
2.
3.
Rather than do what Microsoft does, which is to show the menu items on the frame
window, but disable them, you are going to hide them. The items that should display
when the MDI frame window is active are File and Help.
3.
Rather than do what Microsoft does, which is to show the menu items on the frame
window, but disable them, you are going to hide them. The items that should display
when the MDI frame window is active are File and Help.
4.
Using menu item properties hide Edit and Window on the Menu Bar. Also hide the
following menu items on the File drop down: Start with the Separator under the
Close menu item, down to the Print menu item. Hide everything in-between.
4.
Using menu item properties hide Edit and Window on the Menu Bar. Also hide the
following menu items on the File drop down: Start with the Separator under the
Close menu item, down to the Print menu item. Hide everything in-between.
5.
Those items still appear in the WYSIWYG, but will not be there at runtime. Help will
move left to occupy that space.
5.
Those items still appear in the WYSIWYG, but will not be there at runtime. Help will
move left to occupy that space.
6.
The toolbar icons for Save, Print, Find and Go To do not need to be visible when only
the frame window is active. Disable their ToolBarItemVisible property.
6.
The toolbar icons for Save, Print, Find and Go To do not need to be visible when only
the frame window is active. Disable their ToolBarItemVisible property.
7.
Verify:
7.
Verify:
8.
8.
Lab 6 - 8
1.
Over m_master in the System Tree, right-click and select Inherit from on the context
menu.
1.
Over m_master in the System Tree, right-click and select Inherit from on the context
menu.
2.
2.
3.
What you are about to do is merely an exercise. The item you will add could have
been put into m_master, but you will be learning of a common PowerBuilder menu
property, ShiftToRight.
3.
What you are about to do is merely an exercise. The item you will add could have
been put into m_master, but you will be learning of a common PowerBuilder menu
property, ShiftToRight.
Lab 6 - 8
4.
Over m_sheet in the Tree view of the Menu Painter, right-click and select Insert
Submenu Item. Name the new menubar item &Tools.
4.
Over m_sheet in the Tree view of the Menu Painter, right-click and select Insert
Submenu Item. Name the new menubar item &Tools.
5.
In the Tree view, attempt to drag the Tools item between Edit and Window. Though
it appears to be draggable, you will see an error message in the PowerBuilder status
bar that This item is inheritable and cannot be deleted or moved. This is expected.
Menu items that are inherited cannot be moved.
5.
In the Tree view, attempt to drag the Tools item between Edit and Window. Though
it appears to be draggable, you will see an error message in the PowerBuilder status
bar that This item is inheritable and cannot be deleted or moved. This is expected.
Menu items that are inherited cannot be moved.
6.
To place the menu items in the GUI-accepted position, PowerBuilder menu items
have a ShiftToRight property.
6.
To place the menu items in the GUI-accepted position, PowerBuilder menu items
have a ShiftToRight property.
7.
In the Tree view of the Menu Painter, click on Window and then in Properties enable
ShiftToRight. Look at the WYSIWYG to see the impact. Window is now at the end
of the menu bar.
7.
In the Tree view of the Menu Painter, click on Window and then in Properties enable
ShiftToRight. Look at the WYSIWYG to see the impact. Window is now at the end
of the menu bar.
8.
Repeat the above step by shifting the Help menu item. Tools have now been shifted
into the correct location.
8.
Repeat the above step by shifting the Help menu item. Tools have now been shifted
into the correct location.
9.
In the Tree view, right-click over Tools and select Insert Submenu Item. Add the
following items: &Insert, &Delete, -, &Toolbars, &Options, -, &Export
Data
9.
In the Tree view, right-click over Tools and select Insert Submenu Item. Add the
following items: &Insert, &Delete, -, &Toolbars, &Options, -, &Export
Data
10. For the Insert menu item, set the MenuImage (General Tab of Properties), and
ToolBarItemName properties to use Insert!. For the Delete menu item, use
DeleteRow! for MenuImage and ToolBarItemName. For the Export Data menu item,
use Export5! for MenuImage and ToolBarItemName. Set all of the ToolBarItemText
properties appropriately.
10. For the Insert menu item, set the MenuImage (General Tab of Properties), and
ToolBarItemName properties to use Insert!. For the Delete menu item, use
DeleteRow! for MenuImage and ToolBarItemName. For the Export Data menu item,
use Export5! for MenuImage and ToolBarItemName. Set all of the ToolBarItemText
properties appropriately.
11. Set Exits ToolBarItemOrder to 2 to move that icon out to the end of the toolbar if it is
not already at the end.
11. Set Exits ToolBarItemOrder to 2 to move that icon out to the end of the toolbar if it is
not already at the end.
12. Click again on Insert and Delete menu items, setting their ToolBarItemBarIndex to a
value of 2, noting what that does by looking at the WYSIWYG.
12. Click again on Insert and Delete menu items, setting their ToolBarItemBarIndex to a
value of 2, noting what that does by looking at the WYSIWYG.
Lab 6 - 9
Lab 6 - 9
Lab 6 - 10
14. The ShiftToRight property is somewhat mis-named. It also will shift items down, in a
drop down menu.
14. The ShiftToRight property is somewhat mis-named. It also will shift items down, in a
drop down menu.
15. In the Tree view, right-click over File and select Insert Submenu Item from the
context menu.
15. In the Tree view, right-click over File and select Insert Submenu Item from the
context menu.
17. Use the ShiftToRight property (which in this case will shift down), all of the menu
items under File starting at the Separator after Save As
17. Use the ShiftToRight property (which in this case will shift down), all of the menu
items under File starting at the Separator after Save As
Lab 6 - 10
21. It will appear that the ShiftToRight settings did not get saved. They did. This is a
painter issue. Your menu items will appear correctly when you put the menu on a
window and it displays at runtime.
21. It will appear that the ShiftToRight settings did not get saved. They did. This is a
painter issue. Your menu items will appear correctly when you put the menu on a
window and it displays at runtime.
Lab 6 - 11
Lab 6 - 11
Objectives:
Objectives:
Description:
In this lab, you will associate the menus you just created with application windows. You
will also be coding some of the common menu items.
Description:
In this lab, you will associate the menus you just created with application windows. You
will also be coding some of the common menu items.
Task Outline:
Task Outline:
Lab 6 - 12
Lab 6 - 12
Detailed Instructions
Detailed Instructions
1.
1.
2.
2.
3.
3.
4.
4.
5.
5.
6.
6.
7.
7.
8.
Do you see your menu? Are the items shifted into the correct location as promised?
8.
Do you see your menu? Are the items shifted into the correct location as promised?
_____________________________________________________________________
9.
_____________________________________________________________________
If you are running this lab in PowerBuilder 9 or 10, you will not see the toolbar icons.
Be aware that when using Run/Preview, you are running the application in SDI mode.
It was not until PowerBuilder 10.5 that toolbars displayed for SDI applications.
9.
11. If you were to run w_master_detail_sheet, would you see m_sheets menu? Why or
why not?
11. If you were to run w_master_detail_sheet, would you see m_sheets menu? Why or
why not?
_____________________________________________________________________
If you are running this lab in PowerBuilder 9 or 10, you will not see the toolbar icons.
Be aware that when using Run/Preview, you are running the application in SDI mode.
It was not until PowerBuilder 10.5 that toolbars displayed for SDI applications.
Lab 6 - 13
_____________________________________________________________________
Lab 6 - 13
12. Open w_child and/or w_response. Can you associate m_sheet with these windows?
Why or why not?
12. Open w_child and/or w_response. Can you associate m_sheet with these windows?
Why or why not?
_____________________________________________________________________
_____________________________________________________________________
13. When associating menus to windows it will not be necessary to write any code to
instantiate the menu. The window does it for you.
13. When associating menus to windows it will not be necessary to write any code to
instantiate the menu. The window does it for you.
14. Using the System Tree, right-click over w_sheet and select Edit Source from the
context menu.
14. Using the System Tree, right-click over w_sheet and select Edit Source from the
context menu.
15. In the Class Definition, look for the section named on w_sheet.create. You should see
that menus associated as we have are automatically instantiated (created) behind the
scenes by PowerBuilder. PowerBuilder also automatically destroys the menu (see the
on w_sheet.destroy section).
15. In the Class Definition, look for the section named on w_sheet.create. You should see
that menus associated as we have are automatically instantiated (created) behind the
scenes by PowerBuilder. PowerBuilder also automatically destroys the menu (see the
on w_sheet.destroy section).
16. Also, while we are here, remember in the lab for Module 4, you placed shell events
into w_sheet named: ue_delete, ue_insert, ue_save and ue_print. The fact that those
shells have already been created has bearing on upcoming tasks.
16. Also, while we are here, remember in the lab for Module 4, you placed shell events
into w_sheet named: ue_delete, ue_insert, ue_save and ue_print. The fact that those
shells have already been created has bearing on upcoming tasks.
1.
1.
2.
All coding steps in this task will have you code the default event, Clicked, of the
menu items.
2.
All coding steps in this task will have you code the default event, Clicked, of the
menu items.
3.
Script the FileSave item, generically calling the attached windows ue_save event.
Use the dot notation syntax you learned in Module 4 for firing events. You have two
options here; you can make a DYNAMIC call or a STATIC call (preferred). Two
options you have are shown below:
3.
Script the FileSave item, generically calling the attached windows ue_save event.
Use the dot notation syntax you learned in Module 4 for firing events. You have two
options here; you can make a DYNAMIC call or a STATIC call (preferred). Two
options you have are shown below:
OR:
OR:
STATIC:
w_sheet
lw_sheet
lw_sheet = ParentWindow
lw_sheet.EVENT ue_save( )
STATIC:
w_sheet
lw_sheet
lw_sheet = ParentWindow
lw_sheet.EVENT ue_save( )
4.
Repeating the above step, code the FilePrint item to call ue_print( ).
4.
Repeating the above step, code the FilePrint item to call ue_print( ).
5.
5.
Close(ParentWindow)
Lab 6 - 14
Close(ParentWindow)
Lab 6 - 14
6.
ParentWindow.ArrangeSheets(tile!)
7.
7.
8.
8.
9.
Code the HelpSybHealth Help menu item. You will not be creating a HELP file for
this application, instead, you will just have this item open the PowerBuilder help
system. In this items script, call the ShowHelp( ) PowerScript function. Look at
WinHelp for an example of how to use this function. The name of the PowerBuilder
help file is PBHLP120.hlp and is in the Student folder.
9.
Code the HelpSybHealth Help menu item. You will not be creating a HELP file for
this application, instead, you will just have this item open the PowerBuilder help
system. In this items script, call the ShowHelp( ) PowerScript function. Look at
WinHelp for an example of how to use this function. The name of the PowerBuilder
help file is PBHLP120.hlp and is in the Student folder.
10. Code HelpAbout to open w_about created in the lab for Module 5.
10. Code HelpAbout to open w_about created in the lab for Module 5.
13. Copy the code you put in the Save item to the Windows Clipboard.
13. Copy the code you put in the Save item to the Windows Clipboard.
14. Close the painter. There are reasons we always have you close painters. First, they
are a resource drain on the IDE. If you dont need them open, close them. Second,
you cannot have an ancestor and descendant objects opened at the same time.
PowerBuilder does not allow that.
14. Close the painter. There are reasons we always have you close painters. First, they
are a resource drain on the IDE. If you dont need them open, close them. Second,
you cannot have an ancestor and descendant objects opened at the same time.
PowerBuilder does not allow that.
16. Script the ToolsInsert item by pasting from your clipboard and then changing the
event name to ue_insert( ). Pass a value of 1 to the argument of this event.
16. Script the ToolsInsert item by pasting from your clipboard and then changing the
event name to ue_insert( ). Pass a value of 1 to the argument of this event.
17. Script ToolsDelete the same as above firing ue_delete( ). Pass a value of 1 to the
argument of this event.
17. Script ToolsDelete the same as above firing ue_delete( ). Pass a value of 1 to the
argument of this event.
18. Script ToolsToolbars to open the w_toolbars window you imported in the last
lab. Use the following code:
18. Script ToolsToolbars to open the w_toolbars window you imported in the last
lab. Use the following code:
OpenWithParm(w_toolbars, parentwindow)
OpenWithParm(w_toolbars, parentwindow)
21. More menu items will be coded as you build more components of the SybHealth
system.
21. More menu items will be coded as you build more components of the SybHealth
system.
Lab 6 - 15
Lab 6 - 15
Lab 6 - 16
Lab 6 - 16
Objectives:
Objectives:
Description:
In this lab, you will build the SybHealth MDI Frame window and some of the application
sheets that will open inside of the frame.
Description:
In this lab, you will build the SybHealth MDI Frame window and some of the application
sheets that will open inside of the frame.
Task Outline:
Task Outline:
Lab 7 - 1
Lab 7 - 1
Detailed Instructions
Detailed Instructions
1.
1.
2.
2.
Title:
MenuName:
WindowType:
WindowState:
Title:
MenuName:
WindowType:
WindowState:
3.
Controls cannot be placed on this window, or the Client Area (where sheets are
opened) will shrink to the size of a dot. Controls will go on the sheets that open
inside of the MDI Frame window.
3.
Controls cannot be placed on this window, or the Client Area (where sheets are
opened) will shrink to the size of a dot. Controls will go on the sheets that open
inside of the MDI Frame window.
4.
Save your new window as w_frame in the sybhealth.pbl and close the painter.
4.
Save your new window as w_frame in the sybhealth.pbl and close the painter.
5.
5.
6.
6.
7.
7.
8.
Run the application. To run, you can either right-click over the SybHealth_target in
the System Tree and select Run, or you can click the Running Man icon on the
PowerBar, or you can click RunRun sybhealth_target from the menu.
8.
Run the application. To run, you can either right-click over the SybHealth_target in
the System Tree and select Run, or you can click the Running Man icon on the
PowerBar, or you can click RunRun sybhealth_target from the menu.
9.
9.
10. Click the Exit icon on your SybHealth toolbar. The application will terminate and
you will be returned to your Application object Open event.
10. Click the Exit icon on your SybHealth toolbar. The application will terminate and
you will be returned to your Application object Open event.
12. Now that you have an MDI Frame window (w_frame), you can go back to your
menu(s) and code some additional menu items.
12. Now that you have an MDI Frame window (w_frame), you can go back to your
menu(s) and code some additional menu items.
14. Script the FileClose item to get a handle to the active sheet within the frame
window and then pass that handle to the Close( ) function. A solution for this was
provided in the Student Guide in Module 6.
14. Script the FileClose item to get a handle to the active sheet within the frame
window and then pass that handle to the Close( ) function. A solution for this was
provided in the Student Guide in Module 6.
15. Script FileExit. The code there is working right now, but it is possible that it will
not continue to work properly depending on your use of the menu hierarchy. Change
the code to:
15. Script FileExit. The code there is working right now, but it is possible that it will
not continue to work properly depending on your use of the menu hierarchy. Change
the code to:
Close(w_frame)
Lab 7 - 2
Close(w_frame)
Lab 7 - 2
16. Script WindowClose All. This item will close all of the sheets that have been
opened within the MDI Frame.
16. Script WindowClose All. This item will close all of the sheets that have been
opened within the MDI Frame.
c. In a do-while loop, test to see if the above variable contains a sheet, using the
IsValid( ) PowerScript function. Use WinHelp to look up this function.
c. In a do-while loop, test to see if the above variable contains a sheet, using the
IsValid( ) PowerScript function. Use WinHelp to look up this function.
d. If you have a valid sheet, pass the variable to the Close( ) function.
d. If you have a valid sheet, pass the variable to the Close( ) function.
Lab 7 - 3
Lab 7 - 3
1.
1.
2.
You are creating the Claim Search window. Save the window as w_claims_search in
the claims.pbl. The final window will look as follows:
2.
You are creating the Claim Search window. Save the window as w_claims_search in
the claims.pbl. The final window will look as follows:
3.
3.
4.
4.
5.
Set the DataWindow control location as follows: X 20, Y 470. This will leave
room at the top of the window for entering search criteria.
5.
Set the DataWindow control location as follows: X 20, Y 470. This will leave
room at the top of the window for entering search criteria.
6.
Users can search claims based on a claim number, a patient number, or a claim date.
6.
Users can search claims based on a claim number, a patient number, or a claim date.
7.
Drag a u_st to the top left of the window. Give this control Text of Claim ID:.
7.
Drag a u_st to the top left of the window. Give this control Text of Claim ID:.
8.
With focus on the static text control, press Ctrl-T to duplicate two others whose text
you will set to Patient ID: and Claim Date: respectively.
8.
With focus on the static text control, press Ctrl-T to duplicate two others whose text
you will set to Patient ID: and Claim Date: respectively.
9.
Drag a u_sle onto the window beside the Claim ID static text. Name this control
sle_claim_id.
9.
Drag a u_sle onto the window beside the Claim ID static text. Name this control
sle_claim_id.
10. Duplicate to create another u_sle beside Patient ID. Name this control sle_pat_id.
Lab 7 - 4
10. Duplicate to create another u_sle beside Patient ID. Name this control sle_pat_id.
Lab 7 - 4
11. Drag a u_cb to the right of sle_pat_id. Name this control cb_patid_search. Set other
properties as follows: Text = . Font Bold, Width 140, Height 110. Later,
clicking this button will display a modal window showing patients, letting you select a
patient to obtain his ID.
11. Drag a u_cb to the right of sle_pat_id. Name this control cb_patid_search. Set other
properties as follows: Text = . Font Bold, Width 140, Height 110. Later,
clicking this button will display a modal window showing patients, letting you select a
patient to obtain his ID.
12. Drag a u_em to the right of Claim Date. Name this control em_claim_date. Set the
MaskDataType as datemask!, the Mask property to mm/dd/yyyy and enable the
DropDown Calendar property. Older versions of PowerBuilder may not allow for the
DropDown Calendar. If this is the case, you can still manually enter a date into the
Edit Mask.
12. Drag a u_em to the right of Claim Date. Name this control em_claim_date. Set the
MaskDataType as datemask!, the Mask property to mm/dd/yyyy and enable the
DropDown Calendar property. Older versions of PowerBuilder may not allow for the
DropDown Calendar. If this is the case, you can still manually enter a date into the
Edit Mask.
13. Drag another u_cb to the right of sle_claim_id. Name this button cb_search and
enable the default property.
13. Drag another u_cb to the right of sle_claim_id. Name this button cb_search and
enable the default property.
14. Drag a u_gb (GroupBox control) on top of the above controls and resize the group
box as seen in the illustration shown earlier. Change the group boxs Text to Enter
Search Criteria.
14. Drag a u_gb (GroupBox control) on top of the above controls and resize the group
box as seen in the illustration shown earlier. Change the group boxs Text to Enter
Search Criteria.
15. Verify your work to the picture shown above. The functionality (and DataWindows)
will be finished in later labs.
15. Verify your work to the picture shown above. The functionality (and DataWindows)
will be finished in later labs.
33. Drag a u_dw on top of the window and resize the control so that it covers the majority
of the window.
33. Drag a u_dw on top of the window and resize the control so that it covers the majority
of the window.
Lab 7 - 5
Lab 7 - 5
Lab 7 - 6
Lab 7 - 6
Objectives:
Objectives:
Description:
In this lab, you will be coding menu items to open the application windows (sheets) you
created in Lab 7-1.
Description:
In this lab, you will be coding menu items to open the application windows (sheets) you
created in Lab 7-1.
Task Outline:
Task Outline:
Lab 7 - 7
Lab 7 - 7
Detailed Instructions
Detailed Instructions
1.
Until now, you have been opening windows using the Open( ) PowerScript function.
There are several variations of the Open( ) function which you will explore in this lab.
1.
Until now, you have been opening windows using the Open( ) PowerScript function.
There are several variations of the Open( ) function which you will explore in this lab.
2.
Simple rule: If the window is a Response-type window, it is modal and is not opened
within the boundaries of the frame. Response windows are still displayed with the
Open( ) function. It is common practice to use Response windows for displaying
messages, but also for inputting information.
2.
Simple rule: If the window is a Response-type window, it is modal and is not opened
within the boundaries of the frame. Response windows are still displayed with the
Open( ) function. It is common practice to use Response windows for displaying
messages, but also for inputting information.
3.
If the window will act as a sheet, you will use a new function, OpenSheet( ) as
defined in the materials for Module 7 (see your Student Guide).
3.
If the window will act as a sheet, you will use a new function, OpenSheet( ) as
defined in the materials for Module 7 (see your Student Guide).
4.
4.
5.
You will be scripting the items under the FileNew cascade. These windows are all
Response type windows so use Open( ).
5.
You will be scripting the items under the FileNew cascade. These windows are all
Response type windows so use Open( ).
6.
6.
Open(w_claim_new)
Open(w_claim_new)
7.
7.
8.
8.
9.
Next code the FileOpen cascade menu items. These are all sheets so use the
OpenSheet( ) function instead of Open( ). Use 0 as the Position argument for all of
these menu items. Use Layered! as the ArrangeOpen value for these items.
9.
Next code the FileOpen cascade menu items. These are all sheets so use the
OpenSheet( ) function instead of Open( ). Use 0 as the Position argument for all of
these menu items. Use Layered! as the ArrangeOpen value for these items.
Lab 7 - 8
11. Repeat the above writing code to open w_claims_search in the Claims Search menu
item, w_patient_master_detail in the Patient Details menu item and w_reports in the
Reports menu item.
11. Repeat the above writing code to open w_claims_search in the Claims Search menu
item, w_patient_master_detail in the Patient Details menu item and w_reports in the
Reports menu item.
Lab 7 - 8
14. In the Tree view, right-click over Tools and Insert Submenu Item. Add a separator () and add an item Claim Calculator.
14. In the Tree view, right-click over Tools and Insert Submenu Item. Add a separator () and add an item Claim Calculator.
15. Script the Claim Calculator item to open w_claim_calculator (it is a Response-type
window).
15. Script the Claim Calculator item to open w_claim_calculator (it is a Response-type
window).
17. On the System Tree, right-click over the SybHealth_target and select Full Build. A
Full Build recompiles every script in every object of the target. This should be done
periodically during development. The Output view will display any errors found.
17. On the System Tree, right-click over the SybHealth_target and select Full Build. A
Full Build recompiles every script in every object of the target. This should be done
periodically during development. The Output view will display any errors found.
18. Run the application via the Running Man icon on the PowerBar.
18. Run the application via the Running Man icon on the PowerBar.
19. When the frame appears, use the FileNew cascade menu items making sure your
Response windows all open. Being modal, you can only open one of these at a time.
You cannot click on the icons or menu items while a response window is open.
19. When the frame appears, use the FileNew cascade menu items making sure your
Response windows all open. Being modal, you can only open one of these at a time.
You cannot click on the icons or menu items while a response window is open.
21. Use the FileOpen cascade menu items making sure your Sheet windows all open.
The purpose of an MDI type application is to allow multiple sheets to be opened
within the frame at a given time. You should be able to open multiple sheets within
the frame.
21. Use the FileOpen cascade menu items making sure your Sheet windows all open.
The purpose of an MDI type application is to allow multiple sheets to be opened
within the frame at a given time. You should be able to open multiple sheets within
the frame.
22. With a sheet opened in the Frame, look at your toolbars. You should see some
duplicate icons. This is normal PowerBuilder behavior. The top toolbar comes from
m_frame and the bottom two toolbars come from m_sheet. Both were inherited from
the same menu (m_master), giving them some similar icons.
22. With a sheet opened in the Frame, look at your toolbars. You should see some
duplicate icons. This is normal PowerBuilder behavior. The top toolbar comes from
m_frame and the bottom two toolbars come from m_sheet. Both were inherited from
the same menu (m_master), giving them some similar icons.
24. To control this duplication, you need to re-open m_sheet and disable the
ToolBarItemVisible property (Toolbar tab) for the following menu items:
24. To control this duplication, you need to re-open m_sheet and disable the
ToolBarItemVisible property (Toolbar tab) for the following menu items:
a. FileExit
a. FileExit
25. Still in m_sheet, set the ToolBarItemBarIndex to 1 for the following menu items (too
many rows of toolbars if you dont do this):
25. Still in m_sheet, set the ToolBarItemBarIndex to 1 for the following menu items (too
many rows of toolbars if you dont do this):
a. ToolsInsert
a. ToolsInsert
b. ToolsDelete
b. ToolsDelete
27. Since Exit is currently the only icon on the Frames toolbar, re-open m_frame and
assign the following toolbar icons:
27. Since Exit is currently the only icon on the Frames toolbar, re-open m_frame and
assign the following toolbar icons:
Lab 7 - 9
Lab 7 - 9
28. Run the application and make sure the toolbars look better when opening sheets.
28. Run the application and make sure the toolbars look better when opening sheets.
29. With the application running and a sheet open, click on Window on your menu bar.
You should see the list of open sheets under that menu item. If you wish, open
multiple sheets and verify that you can use that feature to switch between open sheets.
Setting the Position argument to OpenSheet( ) to a value of 0 made the sheet list
appear under the next to last (Window) menu item.
29. With the application running and a sheet open, click on Window on your menu bar.
You should see the list of open sheets under that menu item. If you wish, open
multiple sheets and verify that you can use that feature to switch between open sheets.
Setting the Position argument to OpenSheet( ) to a value of 0 made the sheet list
appear under the next to last (Window) menu item.
30. You also passed Layered! to the OpenSheet( ) function. This made the sheets fill the
Client Area of the frame and covers any other opened sheets. The window was
automatically resized on opening.
30. You also passed Layered! to the OpenSheet( ) function. This made the sheets fill the
Client Area of the frame and covers any other opened sheets. The window was
automatically resized on opening.
31. You also learned that any controls you place on a window do not automatically resize
when the user (or code) resizes the window. This will be covered in the next lab task.
31. You also learned that any controls you place on a window do not automatically resize
when the user (or code) resizes the window. This will be covered in the next lab task.
32. Close any sheets youve opened, but do not close the SybHealth application.
32. Close any sheets youve opened, but do not close the SybHealth application.
Lab 7 - 10
1.
2.
Click on FileNewClaim.
2.
Click on FileNewClaim.
3.
Attempt to resize the New Claim window. You should not be able to. Response-type
windows are not resizable.
3.
Attempt to resize the New Claim window. You should not be able to. Response-type
windows are not resizable.
4.
4.
5.
Click on FileOpenReports.
5.
Click on FileOpenReports.
Lab 7 - 10
The window fills the Client Area of the frame, but the DataWindow control did not
resize.
6.
The window fills the Client Area of the frame, but the DataWindow control did not
resize.
7.
You will write the code to resize the DataWindow when the window resizes.
7.
You will write the code to resize the DataWindow when the window resizes.
8.
8.
9.
Re-open w_reports.
9.
Re-open w_reports.
10. Go to a Script view for the window (first drop down shows w_reports).
10. Go to a Script view for the window (first drop down shows w_reports).
11. Using the second drop down (the Events list), navigate to the Resize event. This
event automatically fires whenever the window is resized.
11. Using the second drop down (the Events list), navigate to the Resize event. This
event automatically fires whenever the window is resized.
12. Notice the arguments for the Resize event. You may need to click the Show/Hide
Prototype icon in the upper right of the Script view to see the arguments. You should
see two useful arguments, newwidth and newheight. When the Resize event fires,
these arguments get populated with the windows new width and new height. You
will use those values to resize the windows controls:
12. Notice the arguments for the Resize event. You may need to click the Show/Hide
Prototype icon in the upper right of the Script view to see the arguments. You should
see two useful arguments, newwidth and newheight. When the Resize event fires,
these arguments get populated with the windows new width and new height. You
will use those values to resize the windows controls:
b. Resize the DataWindow control using its Resize( ) function using the new
width and new height of the window (arguments) minus a small factor so you
leave a border around the DataWindow control.
b. Resize the DataWindow control using its Resize( ) function using the new
width and new height of the window (arguments) minus a small factor so you
leave a border around the DataWindow control.
16. Run the application and open SybHealth Reports. The DataWindow control now
expands, almost covering the window.
16. Run the application and open SybHealth Reports. The DataWindow control now
expands, almost covering the window.
Lab 7 - 11
Lab 7 - 11
Lab 7 - 12
18. The above example was provided to help you better understand how to resize controls
in a PowerBuilder application. These examples only had one control. Think about
how much code would be written if a window had 50 controls.
18. The above example was provided to help you better understand how to resize controls
in a PowerBuilder application. These examples only had one control. Think about
how much code would be written if a window had 50 controls.
Lab 7 - 12
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
Objectives:
Objectives:
Description:
In Lab 2, you looked at the Database Painter and its informative value. In this lab, you
will build some Extended Attributes. These attributes will be stored in the database and
associated to columns in your database tables. This will allow them to be used in the
SybHealth DataWindow objects that you will create in the lab for the next module.
Creating Extended Attributes in the database versus the DataWindow allows for reuse and
consistency of data display. You will be building some simple DataWindow objects in this
module because the two topics are related. More information about DataWindows comes
in the next module.
Description:
In Lab 2, you looked at the Database Painter and its informative value. In this lab, you
will build some Extended Attributes. These attributes will be stored in the database and
associated to columns in your database tables. This will allow them to be used in the
SybHealth DataWindow objects that you will create in the lab for the next module.
Creating Extended Attributes in the database versus the DataWindow allows for reuse and
consistency of data display. You will be building some simple DataWindow objects in this
module because the two topics are related. More information about DataWindows comes
in the next module.
Task Outline:
Task Outline:
Lab 8 - 1
Lab 8 - 1
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Detailed Instructions
Detailed Instructions
Lab 8 - 2
1.
To understand the impact of creating Extended Attributes in the database, you will
begin by creating a DataWindow object prior to creating the Extended Attributes.
You will be led through the DataWindow object creation process. You will learn
more about DataWindows beginning in Module 9.
1.
To understand the impact of creating Extended Attributes in the database, you will
begin by creating a DataWindow object prior to creating the Extended Attributes.
You will be led through the DataWindow object creation process. You will learn
more about DataWindows beginning in Module 9.
2.
2.
3.
Make sure you are connected to the SybHealth database and close the DB Profile
painter.
3.
Make sure you are connected to the SybHealth database and close the DB Profile
painter.
4.
Right-click over the SybHealth_target and select New from the context menu.
4.
Right-click over the SybHealth_target and select New from the context menu.
5.
5.
6.
6.
7.
7.
8.
Select the doctor table and click the Add All button, selecting all the columns.
8.
Select the doctor table and click the Add All button, selecting all the columns.
Lab 8 - 2
Module 8: Using the Database Painter and Working with Extended Attributes
9.
Module 8: Using the Database Painter and Working with Extended Attributes
9.
13. You should now see the Design/Preview views of the DataWindow painter.
13. You should now see the Design/Preview views of the DataWindow painter.
14. Look to the Design view of the DataWindow painter (top). The column headers need
to be changed from the column names to something more acceptable to the end user.
14. Look to the Design view of the DataWindow painter (top). The column headers need
to be changed from the column names to something more acceptable to the end user.
Lab 8 - 3
Lab 8 - 3
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 4
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
15. Click on the dr_id text object in the header band and type ID in its place (do not
enter the quotes around the text). Repeat the process for dr_fname making the header
First Name and dr_lname making the header Last Name:
15. Click on the dr_id text object in the header band and type ID in its place (do not
enter the quotes around the text). Repeat the process for dr_fname making the header
First Name and dr_lname making the header Last Name:
16. If you do not use Extended Attributes, every time you create a DataWindow, you
must change the Header or Label names to something more acceptable.
16. If you do not use Extended Attributes, every time you create a DataWindow, you
must change the Header or Label names to something more acceptable.
17. Close the DataWindow painter without saving the DataWindow object.
17. Close the DataWindow painter without saving the DataWindow object.
Lab 8 - 4
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
1.
1.
2.
In the Objects view, expand the SybHealth profile, expand Tables, expand the doctor
table, then expand the columns folder:
2.
In the Objects view, expand the SybHealth profile, expand Tables, expand the doctor
table, then expand the columns folder:
3.
Over the dr_id column, right-click and select Properties from the context menu.
3.
Over the dr_id column, right-click and select Properties from the context menu.
4.
4.
5.
5.
Lab 8 - 5
Lab 8 - 5
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 6
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
6.
Change the Label property to ID:. Change the Heading property to ID:
6.
Change the Label property to ID:. Change the Heading property to ID:
7.
7.
8.
Repeat this process for the dr_fname and dr_lname columns, giving them First
Name and Last Name labels and headers respectively.
8.
Repeat this process for the dr_fname and dr_lname columns, giving them First
Name and Last Name labels and headers respectively.
9.
9.
10. Repeat Task 1, Steps 4 13, re-creating the doctors list DataWindow object. You
will see the impact of adding Extended Attributes. The headers have your pretty
names instead of using the column names. The Extended Attributes were
automatically copied into your DataWindow object.
10. Repeat Task 1, Steps 4 13, re-creating the doctors list DataWindow object. You
will see the impact of adding Extended Attributes. The headers have your pretty
names instead of using the column names. The Extended Attributes were
automatically copied into your DataWindow object.
11. In the DataWindow painters Preview view, right-click and select Retrieve from the
context menu. Drag the Last Name column (drag the header) in front of the First
Name column. Notice how this updates the Design view as well:
11. In the DataWindow painters Preview view, right-click and select Retrieve from the
context menu. Drag the Last Name column (drag the header) in front of the First
Name column. Notice how this updates the Design view as well:
Lab 8 - 6
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
14. Extended Attributes provide more functionality than making headers pretty. They
allow you to format the data for displaying and editing.
14. Extended Attributes provide more functionality than making headers pretty. They
allow you to format the data for displaying and editing.
15. Right-click over the SybHealth_target and select New from the context menu.
15. Right-click over the SybHealth_target and select New from the context menu.
19. Select the patient table and click the following columns: patient_id, first_name,
middle_name, last_name, date_of_birth, state_code and phone_no columns.
19. Select the patient table and click the following columns: patient_id, first_name,
middle_name, last_name, date_of_birth, state_code and phone_no columns.
22. On the Color and Border Settings dialog set the Text Border to Raised. Click Next.
22. On the Color and Border Settings dialog set the Text Border to Raised. Click Next.
24. You should now be in the Design/Preview view of the DataWindow painter.
24. You should now be in the Design/Preview view of the DataWindow painter.
Lab 8 - 7
Lab 8 - 7
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 8
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
26. Scroll right and make note of the way the date of birth and phone columns data
displays:
26. Scroll right and make note of the way the date of birth and phone columns data
displays:
29. Locate and click on the Extended Attributes tab in the middle-upper portion of the
painter:
29. Locate and click on the Extended Attributes tab in the middle-upper portion of the
painter:
30. Expand the Display Formats node. PowerBuilder automatically provides some
default Display Formats, but you can create your own too.
30. Expand the Display Formats node. PowerBuilder automatically provides some
default Display Formats, but you can create your own too.
32. In the upper-right of the painter, give your Display Format the Style Name of
SybHealth Date, a Data Type of date, and a Format of mmm-dd-yyyy:
32. In the upper-right of the painter, give your Display Format the Style Name of
SybHealth Date, a Data Type of date, and a Format of mmm-dd-yyyy:
Lab 8 - 8
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
34. Creating the Extended Attribute is step one of the process. Step two is to associate the
attribute to columns. This attribute can be created one time but used on many
columns and on different tables.
34. Creating the Extended Attribute is step one of the process. Step two is to associate the
attribute to columns. This attribute can be created one time but used on many
columns and on different tables.
35. In the Objects view of the Database painter, expand SybHealth, tables, patient and
then columns. Right-click over the date_of_birth column and select Properties:
35. In the Objects view of the Database painter, expand SybHealth, tables, patient and
then columns. Right-click over the date_of_birth column and select Properties:
36. Go back to the Properties view of the painter. Click on the Display (for Display
Format) tab.
36. Go back to the Properties view of the painter. Click on the Display (for Display
Format) tab.
37. Using the Display Format drop down, select SybHealth Date from the list:
37. Using the Display Format drop down, select SybHealth Date from the list:
Lab 8 - 9
Lab 8 - 9
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 10
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
39. Test by right-clicking over the patient table (in the Objects view) and select Edit
DataGrid:
39. Test by right-clicking over the patient table (in the Objects view) and select Edit
DataGrid:
40. You will see the data in the Results tab of the Database painter:
40. You will see the data in the Results tab of the Database painter:
41. Scroll right until you see your formatted date_of_birth column.
41. Scroll right until you see your formatted date_of_birth column.
42. Extended Attributes created in the database are automatically copied into every
DataWindow object that uses this column. You can remove or change the attributes
after they have been copied into the DataWindow if necessary.
42. Extended Attributes created in the database are automatically copied into every
DataWindow object that uses this column. You can remove or change the attributes
after they have been copied into the DataWindow if necessary.
43. Over Display Formats on the Extended Attributes tab of the Database painter, rightclick and select New
43. Over Display Formats on the Extended Attributes tab of the Database painter, rightclick and select New
Lab 8 - 10
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
44. Name this Display Format SybHealth Phone, Data type of String, Format of: @@@@@@-@@@@:
44. Name this Display Format SybHealth Phone, Data type of String, Format of: @@@@@@-@@@@:
46. In the Objects view, expand SybHealth, tables, patient and then columns.
46. In the Objects view, expand SybHealth, tables, patient and then columns.
48. Choose the SybHealth Phone Display Format on the Display tab and save your work.
48. Choose the SybHealth Phone Display Format on the Display tab and save your work.
49. Right-click over the patient table and select Edit DataTabular from the context
menu.
49. Right-click over the patient table and select Edit DataTabular from the context
menu.
50. Scroll right to the phone number column to verify your work.
50. Scroll right to the phone number column to verify your work.
51. Note: the Database painter is nothing an end user will see. Dont worry about
resizing columns in its Results view. When you create the DataWindow objects you
will align and size columns as needed.
51. Note: the Database painter is nothing an end user will see. Dont worry about
resizing columns in its Results view. When you create the DataWindow objects you
will align and size columns as needed.
52. Display Formats are for data display. Edit Styles are for data display and
manipulation.
52. Display Formats are for data display. Edit Styles are for data display and
manipulation.
53. On the Extended Attributes tab, right-click over Edit Styles and select New
53. On the Extended Attributes tab, right-click over Edit Styles and select New
54. Name the new Edit Style SybHealth Gender, with a Style Type of Radio Buttons.
54. Name the new Edit Style SybHealth Gender, with a Style Type of Radio Buttons.
Lab 8 - 11
Lab 8 - 11
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 12
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
59. Click the Edit Style tab, select SybHealth Gender from the list box and save your
work:
59. Click the Edit Style tab, select SybHealth Gender from the list box and save your
work:
60. Edit your data using Grid style to test. Resize the gender column to see completely:
60. Edit your data using Grid style to test. Resize the gender column to see completely:
Lab 8 - 12
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
61. Using the processes outlined above, assign the following Display Formats:
61. Using the processes outlined above, assign the following Display Formats:
62. Save your work. Display the data to make sure your claims table has the following
dollar formats:
62. Save your work. Display the data to make sure your claims table has the following
dollar formats:
Lab 8 - 13
Lab 8 - 13
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 14
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
67. Select the state table and Add All columns. Sort ascending by the state_code column:
67. Select the state table and Add All columns. Sort ascending by the state_code column:
69. In the Design view of the DataWindow painter, remove the headers and drag the
header band to the top of the view:
69. In the Design view of the DataWindow painter, remove the headers and drag the
header band to the top of the view:
70. Click on the Tab Order icon on the PainterBar, setting both columns to a value of 0.
Click again on the Tab Order icon.
70. Click on the Tab Order icon on the PainterBar, setting both columns to a value of 0.
Click again on the Tab Order icon.
71. Save this DataWindow as d_dddw_states in the sybhealth.pbl. The dddw indicates a
Drop Down DataWindow.
71. Save this DataWindow as d_dddw_states in the sybhealth.pbl. The dddw indicates a
Drop Down DataWindow.
Lab 8 - 14
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
72. In the Preview view, right-click and select Retrieve. Your data should look as
follows:
72. In the Preview view, right-click and select Retrieve. Your data should look as
follows:
73. Close the DataWindow painter and re-open the Database painter.
73. Close the DataWindow painter and re-open the Database painter.
Lab 8 - 15
Lab 8 - 15
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
76. Enable the Always Show Arrow, Vertical Scroll Bar and AutoRetrieve properties:
Lab 8 - 16
76. Enable the Always Show Arrow, Vertical Scroll Bar and AutoRetrieve properties:
Lab 8 - 16
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
77. Scroll further down the Properties view and set the remainder of the properties as
shown below:
77. Scroll further down the Properties view and set the remainder of the properties as
shown below:
79. Associate the StateList Edit Style to the state_code column of the patient table.
79. Associate the StateList Edit Style to the state_code column of the patient table.
Lab 8 - 17
Lab 8 - 17
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 18
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
81. Create another new Tabular DataWindow from the claim_reasons table as follows:
81. Create another new Tabular DataWindow from the claim_reasons table as follows:
82. In the Design view of the DataWindow painter, remove the headers and drag the
header band to the top of the view:
82. In the Design view of the DataWindow painter, remove the headers and drag the
header band to the top of the view:
83. Click on the Tab Order icon on the PainterBar, setting both columns to a value of 0.
Click again on the Tab Order icon.
83. Click on the Tab Order icon on the PainterBar, setting both columns to a value of 0.
Click again on the Tab Order icon.
Lab 8 - 18
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
85. In the Preview view, right-click and select Retrieve. Your data should look as
follows:
85. In the Preview view, right-click and select Retrieve. Your data should look as
follows:
86. Close the DataWindow painter and re-open the Database painter.
86. Close the DataWindow painter and re-open the Database painter.
89. Enable the Always Show Arrow, Vertical Scroll Bar and AutoRetrieve properties:
89. Enable the Always Show Arrow, Vertical Scroll Bar and AutoRetrieve properties:
Lab 8 - 19
Lab 8 - 19
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 20
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
90. Scroll further down the Properties view and set the remainder of the properties as
shown below:
90. Scroll further down the Properties view and set the remainder of the properties as
shown below:
92. Associate the ClaimReasons Edit Style to the claim_code column in the claims table.
92. Associate the ClaimReasons Edit Style to the claim_code column in the claims table.
Lab 8 - 20
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
94. Using the above steps, create another new tabular DataWindow for the claims_status
table and its columns. Save the datawindow as d_dddw_claims_status in the
claims.pbl:
94. Using the above steps, create another new tabular DataWindow for the claims_status
table and its columns. Save the datawindow as d_dddw_claims_status in the
claims.pbl:
95. Create a ClaimStatus Edit Style, then associate that Edit Style to the claims table,
status_code column. Your data should display as follows:
95. Create a ClaimStatus Edit Style, then associate that Edit Style to the claims table,
status_code column. Your data should display as follows:
Lab 8 - 21
Lab 8 - 21
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 22
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
96. Create one last tabular DataWindow to display from the insurance_coverage table.
When finished, it will look as follows:
96. Create one last tabular DataWindow to display from the insurance_coverage table.
When finished, it will look as follows:
99. In the Database painter, create one last Edit Style named InsuranceCoverages.
Associate InsuranceCoverages to the insurance_type column of the insurance_policy
table. Your data will view as follows:
99. In the Database painter, create one last Edit Style named InsuranceCoverages.
Associate InsuranceCoverages to the insurance_type column of the insurance_policy
table. Your data will view as follows:
Lab 8 - 22
Module 8: Using the Database Painter and Working with Extended Attributes
Module 8: Using the Database Painter and Working with Extended Attributes
101. Name the Validation Rule DoctorCharges. It will have a data type of number. Set the
message to Claims must be greater than or equal to $100.00.
101. Name the Validation Rule DoctorCharges. It will have a data type of number. Set the
message to Claims must be greater than or equal to $100.00.
102. Click the Definition tab and use the @col placeholder to write the appropriate rule:
102. Click the Definition tab and use the @col placeholder to write the appropriate rule:
106. Scroll down and you will see some doctor charges that are not greater or equal to
$100.00. This means the validation rule does not fire on data retrieval. Validation
rules only fire when a change is made to a column with an associated rule.
106. Scroll down and you will see some doctor charges that are not greater or equal to
$100.00. This means the validation rule does not fire on data retrieval. Validation
rules only fire when a change is made to a column with an associated rule.
Lab 8 - 23
Lab 8 - 23
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
Lab 8 - 24
Module 8 Lab: Using the Database Painter and Working with Extended Attributes
107. On any row in the data display, change the dr_charges to 75.00 and press the tab key.
You will see your custom error message.
107. On any row in the data display, change the dr_charges to 75.00 and press the tab key.
You will see your custom error message.
108. Close the Database painter, answering No to the dialog asking you to Save changes
back to data source?
108. Close the Database painter, answering No to the dialog asking you to Save changes
back to data source?
Lab 8 - 24
Objectives:
Objectives:
Description:
In this lab, you will build two DataWindow objects, one that is Tabular to display a Patient
list. This DataWindow will be used later in a Master-Detail interface. The second
DataWindow will be a Grid presentation style to be used for the Claims Search interface.
Description:
In this lab, you will build two DataWindow objects, one that is Tabular to display a Patient
list. This DataWindow will be used later in a Master-Detail interface. The second
DataWindow will be a Grid presentation style to be used for the Claims Search interface.
Task Outline:
Task Outline:
Lab 9 - 1
Lab 9 - 1
Detailed Instructions
Detailed Instructions
1.
2.
Lab 9 - 2
1.
Tabular
SQL Select
Patient
patient_id, last_name, first_name, city, state_code and zip (in
order)
last_name ascending, first_name ascending
(None)
(None)
Raised
Once in Design view of the DataWindow painter, give proper names to the State and
Zip columns (zip header is lower case and shouldnt be).
2.
Tabular
SQL Select
Patient
patient_id, last_name, first_name, city, state_code and zip (in
order)
last_name ascending, first_name ascending
(None)
(None)
Raised
Once in Design view of the DataWindow painter, give proper names to the State and
Zip columns (zip header is lower case and shouldnt be).
3.
3.
4.
Click on the state_code column in the Detail band. Go to the Properties view where
you will click on the Edit tab (for Edit Style). The edit style, StateList, you created in
the last lab was automatically copied into this DataWindow.
4.
Click on the state_code column in the Detail band. Go to the Properties view where
you will click on the Edit tab (for Edit Style). The edit style, StateList, you created in
the last lab was automatically copied into this DataWindow.
5.
Disable the Always Show Arrow property. This will be a read-only DataWindow.
5.
Disable the Always Show Arrow property. This will be a read-only DataWindow.
6.
Resize the width of first_name, last_name and city so that the entire display is seen
without scrolling right (see next page for an example).
6.
Resize the width of first_name, last_name and city so that the entire display is seen
without scrolling right (see next page for an example).
7.
After clicking on the Tab Order icon, set all columns to a sequence of zero. Click the
Tab Order icon again.
7.
After clicking on the Tab Order icon, set all columns to a sequence of zero. Click the
Tab Order icon again.
8.
8.
9.
9.
Lab 9 - 2
10. When your data looks as follows, save and close the Painter:
10. When your data looks as follows, save and close the Painter:
Lab 9 - 3
Lab 9 - 3
2.
Grid
SQL Select
Claims, Doctor, Patient
claim_id, date_of_claim, claim_code, status_code,
dr_charges and amount_paid
doctor.dr_lname + ', ' + doctor.dr_fname AS DoctorFullName
patient.last_name + ', ' + patient.first_name + +
left(patient.middle_name, 1) AS PatientFullName
date_of_claim ascending, amount_paid descending
(None)
(None)
Raised
Style:
Data Source:
Table:
Columns:
Compute(s):
Sort:
Where:
Inputs:
Text Border:
Before leaving SQL Mode of the DataWindow painter, use the Selection List (top of
the screen) and its scrollbar to move the columns into this order:
2.
Lab 9 - 4
Before leaving SQL Mode of the DataWindow painter, use the Selection List (top of
the screen) and its scrollbar to move the columns into this order:
claim_id, date_of_claim, PatientFullName (compute), claim_code, status_code,
DoctorFullName (compute), dr_charges and amount_paid.
3.
Give proper headings to the DataWindow: Claim ID, Claim Date, Patient Name,
Type, Status, Doctor Name, Charged and Paid.
3.
Give proper headings to the DataWindow: Claim ID, Claim Date, Patient Name,
Type, Status, Doctor Name, Charged and Paid.
4.
Resize the Patient Name and Doctor Name columns until you can see all of the data
without scrolling right (see example below).
4.
Resize the Patient Name and Doctor Name columns until you can see all of the data
without scrolling right (see example below).
5.
5.
6.
Click on the claim_code column in the Detail band. Go to the Properties view where
you will click on the Edit tab (for Edit Style). Disable the Always Show Arrow
property. Repeat this process for the claims_status column.
6.
Click on the claim_code column in the Detail band. Go to the Properties view where
you will click on the Edit tab (for Edit Style). Disable the Always Show Arrow
property. Repeat this process for the claims_status column.
7.
7.
8.
Right-justify the Claim Date, Patient Name and Doctor Name columns.
8.
Right-justify the Claim Date, Patient Name and Doctor Name columns.
9.
9.
Lab 9 - 4
10. When your DataWindow looks as follows, save and close the painter:
10. When your DataWindow looks as follows, save and close the painter:
Lab 9 - 5
Lab 9 - 5
Objectives:
Objectives:
Use the DataWindow painter to build DataWindow objects that require input at
runtime.
Use the DataWindow painter to build DataWindow objects that require input at
runtime.
Description:
In this lab, you will build several DataWindow objects to which will require input at
runtime, i.e. Retrieval Arguments. You will begin by completing the Claims Search
DataWindow and then create several new DataWindow objects for the Patient Details, Edit
Policy, and Edit Claim windows.
Description:
In this lab, you will build several DataWindow objects to which will require input at
runtime, i.e. Retrieval Arguments. You will begin by completing the Claims Search
DataWindow and then create several new DataWindow objects for the Patient Details, Edit
Policy, and Edit Claim windows.
Task Outline:
Task Outline:
Lab 9 - 6
Lab 9 - 6
Detailed Instructions
Detailed Instructions
1.
The following is a reminder of a window you created in Lab 7. It shows the possible
search criteria inputs:
1.
The following is a reminder of a window you created in Lab 7. It shows the possible
search criteria inputs:
2.
2.
3.
Once in the DataWindow painter, click on the Data Source icon on the PainterBar (or
click DesignData Source).
3.
Once in the DataWindow painter, click on the Data Source icon on the PainterBar (or
click DesignData Source).
4.
You can always go back into the SQL mode of the DataWindow painter should you
need to add or change anything about the DataWindows SELECT statement.
4.
You can always go back into the SQL mode of the DataWindow painter should you
need to add or change anything about the DataWindows SELECT statement.
5.
5.
Lab 9 - 7
Lab 9 - 7
Lab 9 - 8
6.
6.
7.
Click OK.
7.
Click OK.
Lab 9 - 8
9.
8.
OR:
OR:
(Do not forget the colon in front of the retrieval argument name.)
(Do not forget the colon in front of the retrieval argument name.)
9.
11. In the Specify Retrieval Arguments dialog, you can leave a space or blank in the
arg_claim_id and arg_patient_id and a date of 3-21-1999. This will retrieve three
rows.
11. In the Specify Retrieval Arguments dialog, you can leave a space or blank in the
arg_claim_id and arg_patient_id and a date of 3-21-1999. This will retrieve three
rows.
12. Retrieve again with the same date and a claim id of 200801. This should yield 4
rows. The WHERE clause used the OR logical operator.
12. Retrieve again with the same date and a claim id of 200801. This should yield 4
rows. The WHERE clause used the OR logical operator.
Lab 9 - 9
Lab 9 - 9
Lab 9 - 10
FreeForm
SQL Select
Patient
All columns
(None)
patient_id = :arg_pat_id
arg_pat_id of type Number
Button Face
Lowered
FreeForm
SQL Select
Patient
All columns
(None)
patient_id = :arg_pat_id
arg_pat_id of type Number
Button Face
Lowered
2.
2.
3.
3.
4.
4.
c. Grouping patient details and address details into groupbox objects on the
DataWindow. You can right-click over a groupbox object and Send to Back if
necessary.
c. Grouping patient details and address details into groupbox objects on the
DataWindow. You can right-click over a groupbox object and Send to Back if
necessary.
d. Aligning and setting equivalent spacing between column objects use the
aligning and sizing tool on the PainterBar. You can also use the lasso select to
select multiple objects. Use the arrow keys to move objects without using the
mouse.
d. Aligning and setting equivalent spacing between column objects use the
aligning and sizing tool on the PainterBar. You can also use the lasso select to
select multiple objects. Use the arrow keys to move objects without using the
mouse.
e. Move the detail band up as appropriate when done moving objects around.
e. Move the detail band up as appropriate when done moving objects around.
Lab 9 - 10
5.
5.
6.
6.
7.
When prompted, a valid Patient ID is 10001. Adjust your DataWindow design until
your display is as follows:
7.
When prompted, a valid Patient ID is 10001. Adjust your DataWindow design until
your display is as follows:
8.
8.
9.
In the Properties view use the arrows to scroll the tabs right until you see the Format
tab.
9.
In the Properties view use the arrows to scroll the tabs right until you see the Format
tab.
Lab 9 - 11
Lab 9 - 11
10. The mmm-dd-yyyy Display Format you created in Lab 8 was copied into this
DataWindow.
10. The mmm-dd-yyyy Display Format you created in Lab 8 was copied into this
DataWindow.
12. There is no Edit Style associated with this column. Add an Edit Style while here in
the DataWindow painter.
12. There is no Edit Style associated with this column. Add an Edit Style while here in
the DataWindow painter.
15. Enable the Drop Down Calendar property (PowerBuilder 10.5 and greater).
15. Enable the Drop Down Calendar property (PowerBuilder 10.5 and greater).
17. When a single column has both a Display Format and an Edit Style, which one
prevails?
17. When a single column has both a Display Format and an Edit Style, which one
prevails?
_____________________________________________________________________
_____________________________________________________________________
18. Can you make the Display Format prevail? To answer, go back to the Properties
view, on the Format tab and enable this property:
18. Can you make the Display Format prevail? To answer, go back to the Properties
view, on the Format tab and enable this property:
_____________________________________________________________________
Lab 9 - 12
_____________________________________________________________________
21. In Preview view, click the drop down arrow of the state column. Scroll through all of
the states. You should see some of the state names cut off because of the width of the
drop down.
21. In Preview view, click the drop down arrow of the state column. Scroll through all of
the states. You should see some of the state names cut off because of the width of the
drop down.
24. Go back to the Preview view and click on the drop down arrow for State again. The
cutting off of data should be resolved.
24. Go back to the Preview view and click on the drop down arrow for State again. The
cutting off of data should be resolved.
25. Set the Tab Order of patient_id to a value of 0, all others remain as is.
25. Set the Tab Order of patient_id to a value of 0, all others remain as is.
Lab 9 - 12
1.
FreeForm
SQL Select
Insurance_Policy
All columns
(None)
patient_id = :arg_pat_id
arg_pat_id of type Number
Button Face
Lowered
Style:
Data Source:
Table:
Columns:
Sort:
Where:
Inputs:
Background color:
Columns border:
FreeForm
SQL Select
Insurance_Policy
All columns
(None)
patient_id = :arg_pat_id
arg_pat_id of type Number
Button Face
Lowered
2.
2.
3.
Change the start_date and end_date columns to use an EditMask Edit Style
(Properties view). Enable the use of the Drop Down Calendar.
3.
Change the start_date and end_date columns to use an EditMask Edit Style
(Properties view). Enable the use of the Drop Down Calendar.
4.
4.
5.
5.
6.
6.
7.
In the Code Table, display Active for a value of A, Inactive for a value of I.
7.
In the Code Table, display Active for a value of A, Inactive for a value of I.
8.
Test your work in the Preview view. Click on your date columns to make sure you
have a calendar. Click on the status column to see your drop down choices.
8.
Test your work in the Preview view. Click on your date columns to make sure you
have a calendar. Click on the status column to see your drop down choices.
9.
Click on the insurance_type column. That drop down, when active, is too wide and
displays too many rows.
9.
Click on the insurance_type column. That drop down, when active, is too wide and
displays too many rows.
10. Click on the insurance_type column in Design view. On the Edit tab in Properties,
change the Width of Drop Down(%) to 250 and the Lines in DropDown to 2.
Lab 9 - 13
10. Click on the insurance_type column in Design view. On the Edit tab in Properties,
change the Width of Drop Down(%) to 250 and the Lines in DropDown to 2.
Lab 9 - 13
11. In Preview, click on the coverage drop down to see your changes.
11. In Preview, click on the coverage drop down to see your changes.
Lab 9 - 14
FreeForm
SQL Select
Claims
All columns
(None)
claim_id = :arg_claim_id
arg_claim_id of type Number
Button Face
Lowered
Style:
Data Source:
Table:
Columns:
Sort:
Where:
Inputs:
Background color:
Columns border:
FreeForm
SQL Select
Claims
All columns
(None)
claim_id = :arg_claim_id
arg_claim_id of type Number
Button Face
Lowered
Lab 9 - 14
4. After experimenting with the interface (Preview), you can reduce the Width of the
Type and Status columns.
4. After experimenting with the interface (Preview), you can reduce the Width of the
Type and Status columns.
6. Assign the following Edit Mask to the dr_charges and amount_paid columns:
6. Assign the following Edit Mask to the dr_charges and amount_paid columns:
7. Since the Patient and Doctor numbers dont help a user very much, you will create
some DropDownDataWindows for those two columns. When adding a new claim, the
user can select from the Patient and Doctor from the drop down that will display their
name while saving the ids into the claims table columns.
7. Since the Patient and Doctor numbers dont help a user very much, you will create
some DropDownDataWindows for those two columns. When adding a new claim, the
user can select from the Patient and Doctor from the drop down that will display their
name while saving the ids into the claims table columns.
9. Create a new tabular DataWindow against the doctors table, selecting only the dr_id
column and adding a compute as follows:
9. Create a new tabular DataWindow against the doctors table, selecting only the dr_id
column and adding a compute as follows:
Lab 9 - 15
Lab 9 - 15
Lab 9 - 16
17. Back on d_claims_edit, in Design view, click on the dr_id column and then select the
Edit tab in the Properties view.
17. Back on d_claims_edit, in Design view, click on the dr_id column and then select the
Edit tab in the Properties view.
22. Scroll down more and set the Display Column (what is displayed when the drop down
is not active) to use docfullname.
22. Scroll down more and set the Display Column (what is displayed when the drop down
is not active) to use docfullname.
23. Set the Data Column (what will be written back to the claims table) to use dr_id.
23. Set the Data Column (what will be written back to the claims table) to use dr_id.
Lab 9 - 16
25. Test your Doctor drop down. You may need to widen the display as shown below:
25. Test your Doctor drop down. You may need to widen the display as shown below:
26. Time permitting; repeat the above steps to create a drop down for Patient. The final
Claim Edit DataWindow should look as follows:
26. Time permitting; repeat the above steps to create a drop down for Patient. The final
Claim Edit DataWindow should look as follows:
Lab 9 - 17
Lab 9 - 17
Objectives:
Objectives:
Description:
In this lab, you will build one report DataWindow object, and copy in some pre-defined
reports for later use by the application.
Description:
In this lab, you will build one report DataWindow object, and copy in some pre-defined
reports for later use by the application.
Task Outline:
Task Outline:
Lab 9 - 18
Lab 9 - 18
Detailed Instructions
Detailed Instructions
a. Claim_id
a. Claim_id
b. Dr_charges
b. Dr_charges
c. Amount_paid
c. Amount_paid
d. Status_code
d. Status_code
e. Claim_code
e. Claim_code
a. Patient_id
a. Patient_id
b. First_name
b. First_name
c. Last_name
c. Last_name
d. Date_of_birth
d. Date_of_birth
e. Gender
e. Gender
f.
f.
Phone_no
Lab 9 - 19
Phone_no
Lab 9 - 19
Lab 9 - 20
5. Click on the Join symbol to view the details of the join. Change to use an outer join
displaying patients that may or may not have submitted claims:
5. Click on the Join symbol to view the details of the join. Change to use an outer join
displaying patients that may or may not have submitted claims:
9. Accept the defaults for the remaining prompts and enter the Design/Preview view.
9. Accept the defaults for the remaining prompts and enter the Design/Preview view.
Lab 9 - 20
12. Next, you will spend some time formatting this report so that it looks as follows:
12. Next, you will spend some time formatting this report so that it looks as follows:
13. Still in the DataWindow painter, select RowsSort from the menu.
13. Still in the DataWindow painter, select RowsSort from the menu.
Lab 9 - 21
Lab 9 - 21
Lab 9 - 22
14. Sort on the patient_patient_id column by dragging that column to the Columns list.
This is a client-side sort versus using the Order By (server-side) sort:
14. Sort on the patient_patient_id column by dragging that column to the Columns list.
This is a client-side sort versus using the Order By (server-side) sort:
19. Notice the addition of two new bands for this DataWindow object, a header and a
trailer for the group.
19. Notice the addition of two new bands for this DataWindow object, a header and a
trailer for the group.
20. Click and drag the Header group patient_patient_id band down to make space for other
objects to be placed in this band.
20. Click and drag the Header group patient_patient_id band down to make space for other
objects to be placed in this band.
21. Add text object(s) to the Header group patient_patient_id by clicking Insert Control
Text on the menu. You will need 5 text controls in this band: ID:, Patient:, Date of
Birth:, Gender:, and Phone:. Arrange these in a left to right fashion, leaving room
between each text object for data that will be added in a following step.
21. Add text object(s) to the Header group patient_patient_id by clicking Insert Control
Text on the menu. You will need 5 text controls in this band: ID:, Patient:, Date of
Birth:, Gender:, and Phone:. Arrange these in a left to right fashion, leaving room
between each text object for data that will be added in a following step.
Lab 9 - 22
23. Drag the following columns from the Detail band to the Header group:
patient_patient_id band: patient_patient_id, patient_date_of_birth, patient_gender and
patient_phone_no.
23. Drag the following columns from the Detail band to the Header group:
patient_patient_id band: patient_patient_id, patient_date_of_birth, patient_gender and
patient_phone_no.
28. Increase the width of the computed field to display the entire name.
28. Increase the width of the computed field to display the entire name.
29. Select the Gender column. Increase the width of that column. In the Edit tab of the
Properties pane, set the StyleType to Edit.
29. Select the Gender column. Increase the width of that column. In the Edit tab of the
Properties pane, set the StyleType to Edit.
30. Use the aligning and sizing tools of the painter to clean up the Header group
patient_patient_id band. Your DataWindow should look as follows:
30. Use the aligning and sizing tools of the painter to clean up the Header group
patient_patient_id band. Your DataWindow should look as follows:
31. Drag the following objects from the Header band to the Header group:
patient_patient_id band: Claims_Claim ID, Claims_Dr_Charges, amount paid,
Claims Status Code and Claims Claim Code. Place these in a left to right fashion
under the patient_id column.
31. Drag the following objects from the Header band to the Header group:
patient_patient_id band: Claims_Claim ID, Claims_Dr_Charges, amount paid,
Claims Status Code and Claims Claim Code. Place these in a left to right fashion
under the patient_id column.
32. Individually, rename the text objects as follows: Claim ID, Charged, Paid, Status and
Type.
32. Individually, rename the text objects as follows: Claim ID, Charged, Paid, Status and
Type.
34. Add a line object beneath these objects. Set the Pen Width to 2.
34. Add a line object beneath these objects. Set the Pen Width to 2.
Lab 9 - 23
Lab 9 - 23
35. Remove all remaining objects from the Header band. Your DataWindow should now
look as follows:
35. Remove all remaining objects from the Header band. Your DataWindow should now
look as follows:
36. Add a text object in the Header band that reads Claim Summary for all Patients.
36. Add a text object in the Header band that reads Claim Summary for all Patients.
37. Set the font to 16 point bold and center the text object.
37. Set the font to 16 point bold and center the text object.
Lab 9 - 24
b. Place this computed field under the text object in the Header band.
b. Place this computed field under the text object in the Header band.
39. Align the columns in the Detail band under their respective headers in the Header
group patient_petient_id band.
39. Align the columns in the Detail band under their respective headers in the Header
group patient_petient_id band.
Lab 9 - 24
41. Verify that the DataWindow layout looks similar to the following figure:
41. Verify that the DataWindow layout looks similar to the following figure:
Lab 9 - 25
Lab 9 - 25
a. Expand the Trailer group patient_patient_id band to make space for other
objects to be placed in this band.
a. Expand the Trailer group patient_patient_id band to make space for other
objects to be placed in this band.
d. Repeat steps b and c above to add text objects for Total Charges:, Average
Amount Paid: and Number of Claims:
d. Repeat steps b and c above to add text objects for Total Charges:, Average
Amount Paid: and Number of Claims:
43. Add a computed field by selecting InsertControlComputed Field. Place this object
next to the Number of Claims text object in the Trailer group patient_patient_id band.
Lab 9 - 26
43. Add a computed field by selecting InsertControlComputed Field. Place this object
next to the Number of Claims text object in the Trailer group patient_patient_id band.
45. Increase the width of the computed field and click OK.
45. Increase the width of the computed field and click OK.
46. Add another computed field. Place this object next to the Total Amount Paid text
object in the Trailer group patient_patient_id band.
46. Add another computed field. Place this object next to the Total Amount Paid text
object in the Trailer group patient_patient_id band.
50. Similarly add two more computed fields in the Trailer group patient_patient_id band:
50. Similarly add two more computed fields in the Trailer group patient_patient_id band:
b. A computed field for Average Amount Per Claim. Enter the expression:
avg(claims_amount_paid for group 1)
b. A computed field for Average Amount Per Claim. Enter the expression:
avg(claims_amount_paid for group 1)
c. If the Total Amount Paid, Total Charges, or Average Amount Paid are not
displaying as dollar amounts: Set the computed fields format to Currency by
selecting the $ icon on the PainterBar while selecting the fields. Right-justify
the fields and resize as necessary.
c. If the Total Amount Paid, Total Charges, or Average Amount Paid are not
displaying as dollar amounts: Set the computed fields format to Currency by
selecting the $ icon on the PainterBar while selecting the fields. Right-justify
the fields and resize as necessary.
51. Place another line object at the top of the Trailer group band.
51. Place another line object at the top of the Trailer group band.
52. Add a computed field for the page count to the footer band.
52. Add a computed field for the page count to the footer band.
53. Click on the Header group patient_patient_id band in the Design view.
53. Click on the Header group patient_patient_id band in the Design view.
Lab 9 - 26
55. Your final DataWindow design should look like the following:
56. Click the Retrieve button on the PainterBar toolbar to preview with data.
56. Click the Retrieve button on the PainterBar toolbar to preview with data.
1. In your \Student folder are three DataWindow source files (*.srd files) that represent
some additional reports for the SybHealth application.
1. In your \Student folder are three DataWindow source files (*.srd files) that represent
some additional reports for the SybHealth application.
2. Using the System Tree, right-click over the sybhealth.pbl and select the Import option,
importing each *.srd file. The import dialog allows you to multi-select objects for
importing.
2. Using the System Tree, right-click over the sybhealth.pbl and select the Import option,
importing each *.srd file. The import dialog allows you to multi-select objects for
importing.
3. Open d_rpt_patient.
3. Open d_rpt_patient.
4. Look in the detail band. There are two report objects, d_rpt_insurance_policy and
d_rpt_claims that are part of the patient detail record. This is referred to in
PowerBuilder as Nested DataWindows. Nested DataWindows are one of the topics
taught in FastTrack to PowerBuilder, Part II.
4. Look in the detail band. There are two report objects, d_rpt_insurance_policy and
d_rpt_claims that are part of the patient detail record. This is referred to in
PowerBuilder as Nested DataWindows. Nested DataWindows are one of the topics
taught in FastTrack to PowerBuilder, Part II.
Lab 9 - 27
Lab 9 - 27
Lab 9 - 28
Lab 9 - 28
Objectives:
Objectives:
Description:
In this lab, you will be coding the Login window so that it connects the application to the
SybHealth database. You will also code database disconnect logic in the Application
objects Close event. This code is to be viewed as quick and dirty and will be replaced
later in the course with re-usable code/objects.
Description:
In this lab, you will be coding the Login window so that it connects the application to the
SybHealth database. You will also code database disconnect logic in the Application
objects Close event. This code is to be viewed as quick and dirty and will be replaced
later in the course with re-usable code/objects.
Task Outline:
Task Outline:
Lab 10 - 1
Lab 10 - 1
Detailed Instructions
Detailed Instructions
1.
1.
2.
Navigate to a script view, on cb_oks clicked event. You put code here earlier.
2.
Navigate to a script view, on cb_oks clicked event. You put code here earlier.
3.
Add some new blank lines at the top of the existing code.
3.
Add some new blank lines at the top of the existing code.
4.
Refer to Module 10 in your Student Guide for assistance coding the following steps.
4.
Refer to Module 10 in your Student Guide for assistance coding the following steps.
5.
Using Dot Notation, set the following properties of the default transaction object
named SQLCA:
5.
Using Dot Notation, set the following properties of the default transaction object
named SQLCA:
a. Set the DBMS property equal to the value in the is_dbms instance variable.
a. Set the DBMS property equal to the value in the is_dbms instance variable.
b. Set the DBParm property to contain the ConnectString with the User ID and
Password.
b. Set the DBParm property to contain the ConnectString with the User ID and
Password.
6.
6.
7.
Test for success or failure of the connect statement. If connect failed, display a
message showing the text of what happened and set focus back to the password
singlelineedit control. If the connect was successful, write back to the INI file
(existing statements) and close the login window.
7.
Test for success or failure of the connect statement. If connect failed, display a
message showing the text of what happened and set focus back to the password
singlelineedit control. If the connect was successful, write back to the INI file
(existing statements) and close the login window.
8.
Write a message to the frame windows status bar re: connection success.
8.
Write a message to the frame windows status bar re: connection success.
9.
For extra credit, determine a way to give them three attempts to log in, after which
you HALT CLOSE the application.
9.
For extra credit, determine a way to give them three attempts to log in, after which
you HALT CLOSE the application.
Lab 10 - 2
Lab 10 - 2
Lab 10 - 3
Lab 10 - 3
11. The SybHealth_target is already set to open w_frame (the MDI Frame window) at
startup. See the code in the Application object (a_sybhealth) Open event.
11. The SybHealth_target is already set to open w_frame (the MDI Frame window) at
startup. See the code in the Application object (a_sybhealth) Open event.
13. In the Open event of w_frame, write a script to open your w_login window, passing
the frame (this) as the second argument to the open function call:
13. In the Open event of w_frame, write a script to open your w_login window, passing
the frame (this) as the second argument to the open function call:
Open(w_login, this)
Open(w_login, this)
14. Read in WinHelp what this second argument to the Open PowerScript function does.
14. Read in WinHelp what this second argument to the Open PowerScript function does.
15. Run your application by clicking on the Running Man on the PowerBar.
15. Run your application by clicking on the Running Man on the PowerBar.
16. Given the code, you would think the Frame window would appear, and then the login
window opens on top of the frame. Was that what you saw?
16. Given the code, you would think the Frame window would appear, and then the login
window opens on top of the frame. Was that what you saw?
_____________________________________________________________________
_____________________________________________________________________
17. Cancel/close the login window. The Frame window will appear. Close this window
and go back into the PowerBuilder IDE.
17. Cancel/close the login window. The Frame window will appear. Close this window
and go back into the PowerBuilder IDE.
18. On w_frame, create a new un-mapped event named ue_postopen. This event returns
nothing and has no arguments.
18. On w_frame, create a new un-mapped event named ue_postopen. This event returns
nothing and has no arguments.
19. Cut the code from the Open event (step 13 above) and paste it in your new
ue_postopen( ) event.
19. Cut the code from the Open event (step 13 above) and paste it in your new
ue_postopen( ) event.
20. Navigate back to w_frames Open event, and enter the following code:
20. Navigate back to w_frames Open event, and enter the following code:
21. Review POST versus TRIGGER syntax. By posting, we let the Open event of
w_frame complete, which will then display w_frame, while, in the background,
opening the login window on top of the frame.
21. Review POST versus TRIGGER syntax. By posting, we let the Open event of
w_frame complete, which will then display w_frame, while, in the background,
opening the login window on top of the frame.
22. Click the Running Man to test your work. The password for the application is
sybinsure. Going forward, you will be running the application many times to test
functionality. If you want to make your testing simpler, open w_login and hard
code sybinsure into the sle_pwd.text property. Also enable the cb_ok button because
we currently have code in to enable it only on key_up of the sle_pwd control.
22. Click the Running Man to test your work. The password for the application is
sybinsure. Going forward, you will be running the application many times to test
functionality. If you want to make your testing simpler, open w_login and hard
code sybinsure into the sle_pwd.text property. Also enable the cb_ok button because
we currently have code in to enable it only on key_up of the sle_pwd control.
Lab 10 - 4
1.
1.
2.
Navigate to the Close event. This is the very last code to run in any PowerBuilder
application.
2.
Navigate to the Close event. This is the very last code to run in any PowerBuilder
application.
3.
3.
Lab 10 - 4
c. Error trap the disconnect statement in the same way we did in the connect
logic. This is also an embedded SQL statement.
c. Error trap the disconnect statement in the same way we did in the connect
logic. This is also an embedded SQL statement.
4.
Test your work and when done, exit the running application.
4.
Test your work and when done, exit the running application.
5.
5.
Lab 10 - 5
Lab 10 - 5
Objectives:
Objectives:
Description:
In this lab, you will be coding data retrieval for some of the SybHealth application sheets.
You will complete the Doctor List window, the Claims Search window and the Patient
Search window (to be used on the Claims Search interface).
Description:
In this lab, you will be coding data retrieval for some of the SybHealth application sheets.
You will complete the Doctor List window, the Claims Search window and the Patient
Search window (to be used on the Claims Search interface).
Task Outline:
Task Outline:
Lab 10 - 6
Lab 10 - 6
Detailed Instructions
Detailed Instructions
1.
1.
2.
Make sure you are on the Layout view of the Window painter and then click on the
DataWindow control.
2.
Make sure you are on the Layout view of the Window painter and then click on the
DataWindow control.
3.
3.
_____________________________________________________________________
_____________________________________________________________________
4.
Using the ellipsis button of the DataObject property, associate d_grid_doctors with
the DataWindow control.
4.
Using the ellipsis button of the DataObject property, associate d_grid_doctors with
the DataWindow control.
5.
5.
6.
6.
7.
The SybHealth application will talk to only one database, as will many of your
applications. In that case, the code to associate the DataWindow control with the
Transaction object (SQLCA) is constant. In order to make the coding and
maintenance easier, open u_dw in the User Object painter.
7.
The SybHealth application will talk to only one database, as will many of your
applications. In that case, the code to associate the DataWindow control with the
Transaction object (SQLCA) is constant. In order to make the coding and
maintenance easier, open u_dw in the User Object painter.
8.
8.
9.
Call the SetTransObject( ) function, associating the DataWindow control (THIS) with
the SQLCA Transaction object. Always code generic!
9.
Call the SetTransObject( ) function, associating the DataWindow control (THIS) with
the SQLCA Transaction object. Always code generic!
this.SetTransObject(SQLCA)
this.SetTransObject(SQLCA)
b. Call the DWCs Retrieve( ) function, catching the return in the ll_rows
variable.
b. Call the DWCs Retrieve( ) function, catching the return in the ll_rows
variable.
Lab 10 - 7
Lab 10 - 7
c. In a CHOOSE CASE, evaluate the value of ll_rows. Possible cases are -1:
Error, 0: No rows returned and > 0 is one to many rows returned. Display
appropriate error messages in the case statements and close the window if and
when appropriate. If rows are returned, programmatically set focus to the
DWC.
Lab 10 - 8
c. In a CHOOSE CASE, evaluate the value of ll_rows. Possible cases are -1:
Error, 0: No rows returned and > 0 is one to many rows returned. Display
appropriate error messages in the case statements and close the window if and
when appropriate. If rows are returned, programmatically set focus to the
DWC.
Lab 10 - 8
15. Save your work and test by clicking the Running Man icon.
15. Save your work and test by clicking the Running Man icon.
16. Once logged in and in the MDI Frame, click on FileOpenDoctors List. The data
should be there.
16. Once logged in and in the MDI Frame, click on FileOpenDoctors List. The data
should be there.
17. One of the features of the Grid presentation style DataWindow is the user can, at
runtime, resize columns and drag them into the desired order. These changes are only
temporary. Experiment with these features.
17. One of the features of the Grid presentation style DataWindow is the user can, at
runtime, resize columns and drag them into the desired order. These changes are only
temporary. Experiment with these features.
1.
1.
2.
2.
Lab 10 - 9
Lab 10 - 9
3.
_____________________________________________________________________
_____________________________________________________________________
4.
Using the ellipsis button of the DataObject property, associate d_dddw_pat_list with
the DataWindow control.
4.
Using the ellipsis button of the DataObject property, associate d_dddw_pat_list with
the DataWindow control.
5.
No headers will appear in the layout because there are none in the DataWindow
object.
5.
No headers will appear in the layout because there are none in the DataWindow
object.
6.
6.
7.
SetTransObject( ) was called in u_dws constructor (u_dw was used on all windows
in our application). It doesnt need to be coded here.
7.
SetTransObject( ) was called in u_dws constructor (u_dw was used on all windows
in our application). It doesnt need to be coded here.
8.
In the windows Open event code the retrieve exactly as you did for w_doctor_list in
Task 1.
8.
In the windows Open event code the retrieve exactly as you did for w_doctor_list in
Task 1.
9.
9.
12. In the buttons clicked event, open the w_patient_search window (use Open( ) and not
OpenSheet( ) as this is a Response type window).
12. In the buttons clicked event, open the w_patient_search window (use Open( ) and not
OpenSheet( ) as this is a Response type window).
13. Save your work and test by clicking the Running Man icon.
13. Save your work and test by clicking the Running Man icon.
15. Click on the Ellipsis button on the Claims Search window. You should see your
patient data. You can click on a row, but there is no visual cue that the row was
selected. You will script row highlight logic later in this lab.
15. Click on the Ellipsis button on the Claims Search window. You should see your
patient data. You can click on a row, but there is no visual cue that the row was
selected. You will script row highlight logic later in this lab.
16. You will also be adding code later to get the ID of the patient selected and pass it back
to the Claims Lookup window. Exit the running application.
16. You will also be adding code later to get the ID of the patient selected and pass it back
to the Claims Lookup window. Exit the running application.
1.
1.
2.
2.
3.
3.
_____________________________________________________________________
Lab 10 - 10
_____________________________________________________________________
4.
Using the ellipsis button of the DataObject property, associate d_claims_list with the
DataWindow control.
4.
Using the ellipsis button of the DataObject property, associate d_claims_list with the
DataWindow control.
5.
5.
6.
For this interface, the Retrieve will be coded when the user clicks the Search button.
Navigate to a script view for cb_search.
6.
For this interface, the Retrieve will be coded when the user clicks the Search button.
Navigate to a script view for cb_search.
Lab 10 - 10
7.
a. Declare three long variables to hold claim id, patient id and a row count.
a. Declare three long variables to hold claim id, patient id and a row count.
c. Assign to the claim id and patient id variables using Dot Notation, reading
from the associated singlelineedit controls. Cast the data to the appropriate
type before assigning it to the variable.
c. Assign to the claim id and patient id variables using Dot Notation, reading
from the associated singlelineedit controls. Cast the data to the appropriate
type before assigning it to the variable.
d. The claim date uses an EditMask control. You will get that value differently.
Call the EditMasks (em_claim_date) GetData( ) function, passing in the date
variable by reference. See WinHelp on GetData( ) of an EditMask for an
example of its use.
d. The claim date uses an EditMask control. You will get that value differently.
Call the EditMasks (em_claim_date) GetData( ) function, passing in the date
variable by reference. See WinHelp on GetData( ) of an EditMask for an
example of its use.
e. You must determine which order to pass these variables to the DataWindow.
To determine order, click on the Layout tab of the Window painter. Rightclick over the DWC and select Modify DataWindow When the
DataWindow painter opens, click DesignData Source Then click
DesignRetrieval Arguments. Write the order of the arguments below:
e. You must determine which order to pass these variables to the DataWindow.
To determine order, click on the Layout tab of the Window painter. Rightclick over the DWC and select Modify DataWindow When the
DataWindow painter opens, click DesignData Source Then click
DesignRetrieval Arguments. Write the order of the arguments below:
f.
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
Close the Retrieval Arguments dialog, click the Return icon on the PainterBar,
and then close the DataWindow painter.
f.
Close the Retrieval Arguments dialog, click the Return icon on the PainterBar,
and then close the DataWindow painter.
h. Call dw_datas Retrieve( ) passing in the three variables in the correct order
you learned above, catching the return of the Retrieve( ) in the row count
variable. Evaluate with a CHOOSE CASE as you have done before.
h. Call dw_datas Retrieve( ) passing in the three variables in the correct order
you learned above, catching the return of the Retrieve( ) in the row count
variable. Evaluate with a CHOOSE CASE as you have done before.
Lab 10 - 11
Lab 10 - 11
8.
8.
9.
9.
13. Once tested, exit the running application and close any open painters.
Lab 10 - 12
13. Once tested, exit the running application and close any open painters.
Lab 10 - 12
Objectives:
Objectives:
Description:
In this lab, you will be coding some basic DataWindow functionality such as row
highlighting (both single and multi-select), in a re-usable fashion. You will also be
allowing the user to print and export data from selected DataWindows.
Description:
In this lab, you will be coding some basic DataWindow functionality such as row
highlighting (both single and multi-select), in a re-usable fashion. You will also be
allowing the user to print and export data from selected DataWindows.
Task Outline:
Task Outline:
Lab 10 - 13
Lab 10 - 13
Detailed Instructions
Detailed Instructions
Lab 10 - 14
1.
Scripting row highlighting is a very common task, one which belongs in our ancestor
DataWindow control.
1.
Scripting row highlighting is a very common task, one which belongs in our ancestor
DataWindow control.
2.
Open u_dw.
2.
Open u_dw.
3.
3.
4.
Users may either click on a row to change focus, or they may use the arrow keys.
Given that, navigate to u_dws RowFocusChanged event. Be careful. There is also a
RowFocusChanging event you will not be coding.
4.
Users may either click on a row to change focus, or they may use the arrow keys.
Given that, navigate to u_dws RowFocusChanged event. Be careful. There is also a
RowFocusChanging event you will not be coding.
5.
5.
Lab 10 - 14
6.
6.
7.
7.
8.
Re-open w_patient_search.
8.
Re-open w_patient_search.
9.
9.
10. In the Properties view, scroll to the bottom and enable ib_single_select.
10. In the Properties view, scroll to the bottom and enable ib_single_select.
17. Run the application to test your work. When a row is selected, it is now highlighted
with a blue bar. Note that RowFocusChanged automatically fired on the Retreive( )
as well.
17. Run the application to test your work. When a row is selected, it is now highlighted
with a blue bar. Note that RowFocusChanged automatically fired on the Retreive( )
as well.
18. Click FileOpenDoctor List. When you click a column in the grid it is editable.
Click FileOpenClaims Search. When you click on a column, you cannot edit the
column, but the column turns black which conflicts with the blue status bar. You will
now fix these issues.
18. Click FileOpenDoctor List. When you click a column in the grid it is editable.
Click FileOpenClaims Search. When you click on a column, you cannot edit the
column, but the column turns black which conflicts with the blue status bar. You will
now fix these issues.
Lab 10 - 15
Lab 10 - 15
26. Exit the application and any close any open painters.
26. Exit the application and any close any open painters.
1.
1.
2.
Stub events were added to this window in earlier labs. One event was ue_print.
2.
Stub events were added to this window in earlier labs. One event was ue_print.
3.
3.
dw_data.print( )
dw_data.print( )
4.
4.
5.
Since both w_doctors_list and w_claims_search are inherited from w_data_sheet, you
have just taken care of printing for both windows.
5.
Since both w_doctors_list and w_claims_search are inherited from w_data_sheet, you
have just taken care of printing for both windows.
6.
Run the application and when the above windows are open, click on the Print icon on
the toolbar. It was coded earlier to invoke the ue_print event.
6.
Run the application and when the above windows are open, click on the Print icon on
the toolbar. It was coded earlier to invoke the ue_print event.
7.
There is no printer in the classroom, but you should see the print dialog and if you
print, will receive an error that the printer has a problem. Disregard these errors.
7.
There is no printer in the classroom, but you should see the print dialog and if you
print, will receive an error that the printer has a problem. Disregard these errors.
8.
Open w_patient_master_detail.
8.
Open w_patient_master_detail.
9.
9.
10. In ue_print( ):
Lab 10 - 16
10. In ue_print( ):
a. Right-click and disable the Extend Ancestor Script option on the context
menu. You will be overriding the ancestor code you just put into the
w_data_sheet because Master-Detail displays require a different approach.
a. Right-click and disable the Extend Ancestor Script option on the context
menu. You will be overriding the ancestor code you just put into the
w_data_sheet because Master-Detail displays require a different approach.
d. Call the PrintDataWindow( ) function passing ll_prt and dw_master as the two
arguments.
d. Call the PrintDataWindow( ) function passing ll_prt and dw_master as the two
arguments.
e. Call the PrintDataWindow( ) function, this time passing ll_prt and dw_detail
as the two arguments.
e. Call the PrintDataWindow( ) function, this time passing ll_prt and dw_detail
as the two arguments.
f.
f.
Lab 10 - 16
13. Run the application to test the printing of the Master-Detail window. The window is
incomplete at this point, but you can still test printing. You should see the Print
dialog appear.
13. Run the application to test the printing of the Master-Detail window. The window is
incomplete at this point, but you can still test printing. You should see the Print
dialog appear.
1.
Re-open w_data_sheet.
1.
Re-open w_data_sheet.
2.
Add a new unmapped event to the window. Name this event ue_export. It will return
nothing and have no arguments.
2.
Add a new unmapped event to the window. Name this event ue_export. It will return
nothing and have no arguments.
3.
Code the event to call the DataWindows SaveAs( ) function. Call dw_datas
SaveAs( ) passing it no arguments. With no arguments, SaveAs( ) displays a
Windows File-Save dialog. The user can select the type of data to export and the
directory.
3.
Code the event to call the DataWindows SaveAs( ) function. Call dw_datas
SaveAs( ) passing it no arguments. With no arguments, SaveAs( ) displays a
Windows File-Save dialog. The user can select the type of data to export and the
directory.
4.
4.
5.
5.
6.
Script the ToolsExport Data menu items Clicked event to call ue_export:
6.
Script the ToolsExport Data menu items Clicked event to call ue_export:
w_data_sheet
lw_data_sheet
lw_data_sheet = ParentWindow
lw_data_sheet.event ue_export( )
w_data_sheet
lw_data_sheet
lw_data_sheet = ParentWindow
lw_data_sheet.event ue_export( )
Lab 10 - 17
Lab 10 - 17
Lab 10 - 18
7.
7.
8.
8.
9.
9.
10. Click on the Export icon. Save the files in your Student folder. Repeat this step many
times, exporting the following: CSV, Text with Headers, XML, PDF, Excel8 with
Headers, SQL, HTML, Powersoft Report. Those are common export types.
10. Click on the Export icon. Save the files in your Student folder. Repeat this step many
times, exporting the following: CSV, Text with Headers, XML, PDF, Excel8 with
Headers, SQL, HTML, Powersoft Report. Those are common export types.
11. Spend a few minutes looking at your exported data files via Windows Explorer.
11. Spend a few minutes looking at your exported data files via Windows Explorer.
12. Exit the running application and close any opened painters.
12. Exit the running application and close any opened painters.
Lab 10 - 18
Objectives:
Objectives:
Description:
In this lab, you will be completing the FileNew functionality, coding the application so
that the user can enter new Claims, Patients or Policies. Only Claims and Doctors can be
deleted in the SybHealth application at the completion of this lab. Patient deletion will be
coded later. Inserting and deleting in a DataWindow does not impact the underlying
database. Only the DataWindow buffers are impacted. You will not be able to fully test
this functionality until the next lab.
Description:
In this lab, you will be completing the FileNew functionality, coding the application so
that the user can enter new Claims, Patients or Policies. Only Claims and Doctors can be
deleted in the SybHealth application at the completion of this lab. Patient deletion will be
coded later. Inserting and deleting in a DataWindow does not impact the underlying
database. Only the DataWindow buffers are impacted. You will not be able to fully test
this functionality until the next lab.
Task Outline:
Task Outline:
Lab 11 - 1
Lab 11 - 1
Detailed Instructions
Detailed Instructions
Lab 11 - 2
1.
From this point, scripting exercises will not always include the solution code. Enough
information is being given to complete a scripting task. If, however, you cannot
perform the task, remember that solutions are provided for each lab. You can always
add a target for the solution of a given module to your workspace and look there for
the code. Be sure you do not confuse the solution target with the student target.
1.
From this point, scripting exercises will not always include the solution code. Enough
information is being given to complete a scripting task. If, however, you cannot
perform the task, remember that solutions are provided for each lab. You can always
add a target for the solution of a given module to your workspace and look there for
the code. Be sure you do not confuse the solution target with the student target.
2.
2.
3.
In the Script view, add a new un-mapped event named ue_insert that returns a long
and has one integer argument named ai_ins_location.
3.
In the Script view, add a new un-mapped event named ue_insert that returns a long
and has one integer argument named ai_ins_location.
4.
4.
5.
Scripting the insert in w_data_response will allow us to code the InsertRow( ) one
time versus three times (for Claims, Patients and Policies).
5.
Scripting the insert in w_data_response will allow us to code the InsertRow( ) one
time versus three times (for Claims, Patients and Policies).
6.
6.
7.
7.
8.
Click on the DataWindow control on the Layout view and then set the DataObject
property to use d_claims_edit.
8.
Click on the DataWindow control on the Layout view and then set the DataObject
property to use d_claims_edit.
9.
9.
11. Change the windows width property to 2500 and height to 840.
11. Change the windows width property to 2500 and height to 840.
Lab 11 - 2
13. Navigate to the windows ue_insert( ) event. Events extend by default AND run top
down, so the InsertRow( ) code you put in the ancestor will execute first.
13. Navigate to the windows ue_insert( ) event. Events extend by default AND run top
down, so the InsertRow( ) code you put in the ancestor will execute first.
f.
f.
g. Write the new id to the claim_id column of the DataWindow. To do this, call
dw_datas SetItem( ) function, passing it ll_newrow, claim_id and ll_new_id
as the three required arguments.
g. Write the new id to the claim_id column of the DataWindow. To do this, call
dw_datas SetItem( ) function, passing it ll_newrow, claim_id and ll_new_id
as the three required arguments.
Lab 11 - 3
Lab 11 - 3
Lab 11 - 4
Lab 11 - 4
16. Code the Open event of w_claim_new to invoke the ue_insert( ) event, passing a
value of 1 to the argument.
16. Code the Open event of w_claim_new to invoke the ue_insert( ) event, passing a
value of 1 to the argument.
17. Save w_claim_new and test your application. You can complete the new claim
window, but until the next lab, you will not be saving anything. Test that your claim
window appears with a blank row and the new claim id is set.
17. Save w_claim_new and test your application. You can complete the new claim
window, but until the next lab, you will not be saving anything. Test that your claim
window appears with a blank row and the new claim id is set.
24. Copy the code from the ue_insert( ) of w_claim_new and paste into w_patient_news
ue_insert( ) event. Change the tablename in the embedded SQL statements from
claims to patient. Be sure to also change the column name in the SetItem( )
function call to patient_id. Navigate to the windows Open event and write script to
call ue_insert( ) passing a 1 to his argument.
24. Copy the code from the ue_insert( ) of w_claim_new and paste into w_patient_news
ue_insert( ) event. Change the tablename in the embedded SQL statements from
claims to patient. Be sure to also change the column name in the SetItem( )
function call to patient_id. Navigate to the windows Open event and write script to
call ue_insert( ) passing a 1 to his argument.
25. Ideally, the scripts containing the embedded SELECT, the embedded UPDATE and
the error checking and commit/rollback could all be functions in the ancestor where
the variables (tablename, transaction object, etc.) could be function arguments. Then
you would not have the same code to maintain in multiple places.
25. Ideally, the scripts containing the embedded SELECT, the embedded UPDATE and
the error checking and commit/rollback could all be functions in the ancestor where
the variables (tablename, transaction object, etc.) could be function arguments. Then
you would not have the same code to maintain in multiple places.
Lab 11 - 5
Lab 11 - 5
Lab 11 - 6
27. w_policy_edit will be slightly different due to the nature of the data schema. There is
no policy_id column in the insurance_policy table. The primary key for that table is
the patient_id column. You will not need to calculate a new primary key value.
Instead, you will replace the patient_id column with a drop down DataWindow
allowing the user select the patient for a given policy. The drop down DataWindow
should only display patients that dont already have a policy.
27. w_policy_edit will be slightly different due to the nature of the data schema. There is
no policy_id column in the insurance_policy table. The primary key for that table is
the patient_id column. You will not need to calculate a new primary key value.
Instead, you will replace the patient_id column with a drop down DataWindow
allowing the user select the patient for a given policy. The drop down DataWindow
should only display patients that dont already have a policy.
31. Click on the Where tab at the bottom of the screen (this area is called the SQL
Toolbox).
31. Click on the Where tab at the bottom of the screen (this area is called the SQL
Toolbox).
34. Right-click under the Value column and click on Select from the context menu.
34. Right-click under the Value column and click on Select from the context menu.
35. It will look like the DataWindow painter re-opened. You are ready to graphically
depict a nested SELECT statement. Select the insurance_policy table and click Open.
35. It will look like the DataWindow painter re-opened. You are ready to graphically
depict a nested SELECT statement. Select the insurance_policy table and click Open.
38. You will see your nested SELECT pasted under the Value column of the WHERE
clause:
38. You will see your nested SELECT pasted under the Value column of the WHERE
clause:
40. Make sure you get data by retrieving in the Preview view.
40. Make sure you get data by retrieving in the Preview view.
44. In the Properties view, scroll right until you can select the Edit tab.
44. In the Properties view, scroll right until you can select the Edit tab.
46. Enable Always Show Arrow and Vertical Scroll Bar properties.
46. Enable Always Show Arrow and Vertical Scroll Bar properties.
Lab 11 - 6
54. Set the width of the patient_id column to 875 (on the Position tab in Properties).
54. Set the width of the patient_id column to 875 (on the Position tab in Properties).
60. Set the DataWindow controls width to 2085 and height to 400.
60. Set the DataWindow controls width to 2085 and height to 400.
65. There are no primary key calculations necessary for this window. Navigate to the
windows Open event and script the invocation of the ue_insert(). Pass a value of 1 to
the event.
65. There are no primary key calculations necessary for this window. Navigate to the
windows Open event and script the invocation of the ue_insert(). Pass a value of 1 to
the event.
68. When tested, exit the application and close any open painters.
68. When tested, exit the application and close any open painters.
Lab 11 - 7
Lab 11 - 7
Lab 11 - 8
1.
Open w_data_sheet.
1.
Open w_data_sheet.
2.
2.
3.
3.
4.
In a message box, confirm that the user wants to delete the current row. Give them a
choice of yes or no where the no button has focus. Assign the return of the message
box to the li_ret variable.
4.
In a message box, confirm that the user wants to delete the current row. Give them a
choice of yes or no where the no button has focus. Assign the return of the message
box to the li_ret variable.
5.
5.
6.
6.
7.
Return li_del.
7.
Return li_del.
Lab 11 - 8
8.
8.
9.
The menus were coded earlier to call the ue_delete( ) event, so you are ready to run
the application.
9.
The menus were coded earlier to call the ue_delete( ) event, so you are ready to run
the application.
10. Open both Doctor List and Claims Search windows to test the functionality. On
Claims Search, enter a patient ID of 10001 and you will have many claims you might
delete.
10. Open both Doctor List and Claims Search windows to test the functionality. On
Claims Search, enter a patient ID of 10001 and you will have many claims you might
delete.
11. You may notice after deleting a row that the DataWindow is not automatically giving
focus back to row 1. Exit the application.
11. You may notice after deleting a row that the DataWindow is not automatically giving
focus back to row 1. Exit the application.
dw_data.event rowfocuschanged(1)
dw_data.event rowfocuschanged(1)
15. Run the application to test the impact. Remember, if you delete a claim or doctor,
then close and re-open the window, that claim or doctor will have returned to the
display. At this stage, you are only moving rows from the Primary buffer to the
Delete buffer. At the end of the next lab, you will be updating the database with these
changes (inserts and deletes).
15. Run the application to test the impact. Remember, if you delete a claim or doctor,
then close and re-open the window, that claim or doctor will have returned to the
display. At this stage, you are only moving rows from the Primary buffer to the
Delete buffer. At the end of the next lab, you will be updating the database with these
changes (inserts and deletes).
16. When satisfied, exit the running application and close any open painters.
16. When satisfied, exit the running application and close any open painters.
Lab 11 - 9
Lab 11 - 9
Lab 11 - 10
Lab 11 - 10
Objectives:
Objectives:
Description:
In this lab, you will be writing data update functionality for your application. The purpose
of this lab is to show you how easy that process is, and to give you typical PowerBuilder
code for updating via DataWindows. You will only be updating from the Claims Search
window at this point, where you will select a claim and delete the claim then save your
changes. Other application windows will have their data updated in later labs.
Description:
In this lab, you will be writing data update functionality for your application. The purpose
of this lab is to show you how easy that process is, and to give you typical PowerBuilder
code for updating via DataWindows. You will only be updating from the Claims Search
window at this point, where you will select a claim and delete the claim then save your
changes. Other application windows will have their data updated in later labs.
Procedure
1.
Procedure
1.
2.
2.
3.
3.
4.
4.
b. Call the DataWindow controls Update( ) function, assigning the return to the
li_ret variable.
b. Call the DataWindow controls Update( ) function, assigning the return to the
li_ret variable.
i. Check the return from the transaction object following the commit. If
SQLCODE <> 0 then display an appropriate message box.
i. Check the return from the transaction object following the commit. If
SQLCODE <> 0 then display an appropriate message box.
i. You are rolling back because the Update( ) failed. Issue a message to
the user telling them the update failed. Always put messages after
commits and/or rollbacks.
i. You are rolling back because the Update( ) failed. Issue a message to
the user telling them the update failed. Always put messages after
commits and/or rollbacks.
ii. Check the return from the transaction object following the rollback. If
SQLCODE <> 0 then display an appropriate message box.
ii. Check the return from the transaction object following the rollback. If
SQLCODE <> 0 then display an appropriate message box.
Lab 12 - 1
Lab 12 - 1
Lab 12 - 2
5.
5.
6.
6.
7.
ue_save( ) is an unmapped event and must be called. For now, it will only be called
from the Client Search window when they click on the Delete icon (or
ToolsDelete).
7.
ue_save( ) is an unmapped event and must be called. For now, it will only be called
from the Client Search window when they click on the Delete icon (or
ToolsDelete).
8.
8.
9.
9.
Lab 12 - 2
16. Go to the properties view of w_claims_search. Scroll to the bottom of the General tab
and enable the ib_updatable property.
16. Go to the properties view of w_claims_search. Scroll to the bottom of the General tab
and enable the ib_updatable property.
19. Place the following code that will hide unnecessary toolbar icons in the Open:
19. Place the following code that will hide unnecessary toolbar icons in the Open:
20. Use the above sample to programmatically disable unnecessary icons in w_reports
Open event. Understand that disabling the toolbar icons does not disable the menu
items.
20. Use the above sample to programmatically disable unnecessary icons in w_reports
Open event. Understand that disabling the toolbar icons does not disable the menu
items.
22. Test by finding a claim, selecting it, and then clicking the Delete icon on the toolbar.
22. Test by finding a claim, selecting it, and then clicking the Delete icon on the toolbar.
23. When prompted the first time, click No on the Delete Confirmation message.
Nothing should happen.
23. When prompted the first time, click No on the Delete Confirmation message.
Nothing should happen.
24. Delete again, this time clicking yes on the confirmation dialog.
24. Delete again, this time clicking yes on the confirmation dialog.
25. You will receive a message that the DataWindow does not have UPDATE
capabilities. This is expected. You will correct this situation in a later lab.
25. You will receive a message that the DataWindow does not have UPDATE
capabilities. This is expected. You will correct this situation in a later lab.
Lab 12 - 3
Lab 12 - 3
Lab 12 - 4
Lab 12 - 4
Objectives:
Objectives:
Overload methods
Overload methods
Description:
In this lab, you will be partitioning code that has been embedded in the Application object
as an object-function (of_report_error). Since the Application object is target specific (and
not inheritable), to reuse this function you would have to re-create it in every application.
This lab has you take a more object-oriented approach to re-using the Error object
functionality. You will also be creating your own Transaction object. Earlier, you wrote
code in the Login window to connect to the database. Now, you will make it a series of
object functions in your own Transaction object.
Description:
In this lab, you will be partitioning code that has been embedded in the Application object
as an object-function (of_report_error). Since the Application object is target specific (and
not inheritable), to reuse this function you would have to re-create it in every application.
This lab has you take a more object-oriented approach to re-using the Error object
functionality. You will also be creating your own Transaction object. Earlier, you wrote
code in the Login window to connect to the database. Now, you will make it a series of
object functions in your own Transaction object.
Task Outline:
Task Outline:
Lab 13 - 1
Lab 13 - 1
Detailed Instructions
Detailed Instructions
Lab 13 - 2
1.
In the System Tree, right-click over the sybhealth_target and select Properties.
1.
In the System Tree, right-click over the sybhealth_target and select Properties.
2.
On the Library List, click the New button, adding a new system_management.pbl in
your \Framework folder.
2.
On the Library List, click the New button, adding a new system_management.pbl in
your \Framework folder.
3.
3.
4.
In the System Tree, right-click over the sybhealth_target and select New
4.
In the System Tree, right-click over the sybhealth_target and select New
5.
5.
6.
6.
7.
Click OK.
7.
Click OK.
8.
Note the properties of this object. These are all populated when runtime errors occur.
They can provide you with detailed information about the error.
8.
Note the properties of this object. These are all populated when runtime errors occur.
They can provide you with detailed information about the error.
9.
9.
10. Click InsertFunction to create a new object-level function. The function will return
(None) and have no arguments. Name the function of_report_error.
10. Click InsertFunction to create a new object-level function. The function will return
(None) and have no arguments. Name the function of_report_error.
14. Switch back to n_err and paste the code into your new function.
14. Switch back to n_err and paste the code into your new function.
18. Save.
18. Save.
21. Delete the string variables since we now have Instance Variables.
21. Delete the string variables since we now have Instance Variables.
22. Replace any references to ls_err with is_err_text. Use EditReplace. Do not use the
Replace All button unless you are sure this will not cause errors.
22. Replace any references to ls_err with is_err_text. Use EditReplace. Do not use the
Replace All button unless you are sure this will not cause errors.
Lab 13 - 2
24. Cut the lines of code that write to the log file.
24. Cut the lines of code that write to the log file.
25. Paste them into the of_log_to_file( ) function. Add an int li_file_handle declaration to
the top of this function.
25. Paste them into the of_log_to_file( ) function. Add an int li_file_handle declaration to
the top of this function.
27. Remove the hard-coded file name (the first argument to FileOpen( )) and replace it
with your constant variable, is_file_name:
27. Remove the hard-coded file name (the first argument to FileOpen( )) and replace it
with your constant variable, is_file_name:
28. Save.
28. Save.
31. At the end of the code that populates the is_err_text variable, add an if statement
checking the value of ib_file_out. If true, call the of_log_to_file( ) function.
31. At the end of the code that populates the is_err_text variable, add an if statement
checking the value of ib_file_out. If true, call the of_log_to_file( ) function.
Lab 13 - 3
Lab 13 - 3
Lab 13 - 4
32. Also add an if statement checking the value of ib_message_out. If true, then invoke
the existing messagebox function call:
32. Also add an if statement checking the value of ib_message_out. If true, then invoke
the existing messagebox function call:
Lab 13 - 4
42. Change the code that was calling the embedded object function to a call of errors
of_report_error:
42. Change the code that was calling the embedded object function to a call of errors
of_report_error:
error.of_report_error( )
error.of_report_error( )
43. Save. If you receive a compiler error on saving, comment out the above line, save,
then uncomment and save again. Some times PowerBuilder does not immediately see
a change you make to the Variable Types properties.
43. Save. If you receive a compiler error on saving, comment out the above line, save,
then uncomment and save again. Some times PowerBuilder does not immediately see
a change you make to the Variable Types properties.
44. You have just completed your first partitioning task. You now have a PBL/objects
(system_management.pbl) that will be reusable by all PowerBuilder applications you
create going forward.
44. You have just completed your first partitioning task. You now have a PBL/objects
(system_management.pbl) that will be reusable by all PowerBuilder applications you
create going forward.
Lab 13 - 5
Lab 13 - 5
1.
Open w_login. Review the code you put into cb_oks Clicked event.
1.
Open w_login. Review the code you put into cb_oks Clicked event.
2.
There are distinct operations in that code: initializing the Transaction objects
(SQLCA) properties, connecting and error checking of the embedded SQL and
displaying a message on error. There is also disconnect code elsewhere. And, youve
written code to commit and rollback which also required error checking. All of this is
code that does not change and will be used many places within your applications. We
will make these operations functions in our own Transaction object.
2.
There are distinct operations in that code: initializing the Transaction objects
(SQLCA) properties, connecting and error checking of the embedded SQL and
displaying a message on error. There is also disconnect code elsewhere. And, youve
written code to commit and rollback which also required error checking. All of this is
code that does not change and will be used many places within your applications. We
will make these operations functions in our own Transaction object.
3.
Close w_login.
3.
Close w_login.
4.
In the System Tree, right-click over the SybHealth_target and select New
4.
In the System Tree, right-click over the SybHealth_target and select New
5.
5.
6.
6.
7.
Click OK.
7.
Click OK.
8.
8.
9.
9.
Lab 13 - 6
a. Private
Boolean
ib_init
b. Public
Boolean
ib_conn
Boolean
ib_init
b. Public
Boolean
ib_conn
11. Click InsertFunction to create a new object-level function. The function will return
(None) and have five string arguments (as_user, as_pwd, as_servername, as_dbname,
as_dbms). Name the function of_init.
11. Click InsertFunction to create a new object-level function. The function will return
(None) and have five string arguments (as_user, as_pwd, as_servername, as_dbname,
as_dbms). Name the function of_init.
12. Code of_init to set the corresponding properties of the transaction object and then set
the ib_init variable to true. Sample code follows:
12. Code of_init to set the corresponding properties of the transaction object and then set
the ib_init variable to true. Sample code follows:
13. Save.
13. Save.
Lab 13 - 6
14. Using the middle drop down of the Function view, create a new function, also named
of_init. This function returns (None). It has four string arguments, as_user, as_pwd,
as_dbms and as_dsn.
14. Using the middle drop down of the Function view, create a new function, also named
of_init. This function returns (None). It has four string arguments, as_user, as_pwd,
as_dbms and as_dsn.
15. What is it called when you have two functions with the same name but a different a)
type, b) order, or c) number of arguments?
15. What is it called when you have two functions with the same name but a different a)
type, b) order, or c) number of arguments?
_____________________________________________________________________
_____________________________________________________________________
17. In the classroom, we will use ODBC to get to the SQL Anywhere database, so the
above of_init will be used instead of the one for native connections.
17. In the classroom, we will use ODBC to get to the SQL Anywhere database, so the
above of_init will be used instead of the one for native connections.
18. Save.
18. Save.
19. Insert a new function. Name this function of_check_and_report. It returns an integer
and has one string argument named as_context.
19. Insert a new function. Name this function of_check_and_report. It returns an integer
and has one string argument named as_context.
20. The function code will check this objects sqlcode for <> 0. If <> 0 then display a
message for the user containing the error number (sqldbcode) and the error text
(sqlerrtext). Display the context arguments value in the title of the message box.
Return the value of the sqlcode property:
20. The function code will check this objects sqlcode for <> 0. If <> 0 then display a
message for the user containing the error number (sqldbcode) and the error text
(sqlerrtext). Display the context arguments value in the title of the message box.
Return the value of the sqlcode property:
21. You have coded the above in a few places already in the application. No more. You
will be able to call this function from anywhere in the application going forward.
21. You have coded the above in a few places already in the application. No more. You
will be able to call this function from anywhere in the application going forward.
22. Insert a new function. Name this function of_connect. It returns (None) and has no
arguments.
22. Insert a new function. Name this function of_connect. It returns (None) and has no
arguments.
Lab 13 - 7
Lab 13 - 7
Lab 13 - 8
23. Code this function with an embedded SQL statement to connect, as you did in
w_login (cb_ok, Clicked). Always code generically. Only connect if the ib_init
variable is set to true. After the connect statement, call the of_check_and_report( )
function. If that function returns a 0 (good connection) then set ib_conn = true:
23. Code this function with an embedded SQL statement to connect, as you did in
w_login (cb_ok, Clicked). Always code generically. Only connect if the ib_init
variable is set to true. After the connect statement, call the of_check_and_report( )
function. If that function returns a 0 (good connection) then set ib_conn = true:
24. Save.
24. Save.
25. Insert a new function. Name this function of_disconnect. It returns an integer and
has no arguments.
25. Insert a new function. Name this function of_disconnect. It returns an integer and
has no arguments.
26. Code this function with an embedded SQL statement to disconnect, as you did in
a_sybhealth Application object (Close event). Always code generically. Only
disconnect if the ib_conn variable is set to true. After the disconnect statement, call
the of_check_and_report( ) function. If that function returns a 0 (good disconnection)
then set ib_conn = false:
26. Code this function with an embedded SQL statement to disconnect, as you did in
a_sybhealth Application object (Close event). Always code generically. Only
disconnect if the ib_conn variable is set to true. After the disconnect statement, call
the of_check_and_report( ) function. If that function returns a 0 (good disconnection)
then set ib_conn = false:
27. Save.
27. Save.
28. Insert a new function named of_commit that returns (None) and has no arguments.
28. Insert a new function named of_commit that returns (None) and has no arguments.
29. Code this function with the embedded SQL statement to commit and then call the
of_check_and_report( ) function.
29. Code this function with the embedded SQL statement to commit and then call the
of_check_and_report( ) function.
30. Repeat the above two steps making the appropriate changes for an of_rollback
function:
30. Repeat the above two steps making the appropriate changes for an of_rollback
function:
Lab 13 - 8
33. On the Properties view, click the Additional Properties button and then select the
Variable Types tab.
33. On the Properties view, click the Additional Properties button and then select the
Variable Types tab.
34. Replace the native PowerBuilder transaction with your new n_tr:
34. Replace the native PowerBuilder transaction with your new n_tr:
39. Comment out the lines where you were setting sqlcas properties. Replace them with
a call to your of_init( ) function, passing the necessary inputs.
39. Comment out the lines where you were setting sqlcas properties. Replace them with
a call to your of_init( ) function, passing the necessary inputs.
40. Comment out the embedded SQL statement connecting and replace it with a call to
your of_connect( ) function.
40. Comment out the embedded SQL statement connecting and replace it with a call to
your of_connect( ) function.
41. If sqlcas ib_conn is not true, then set focus back to sle_pwd. Otherwise, keep your
lines writing to the ini file, etc:
41. If sqlcas ib_conn is not true, then set focus back to sle_pwd. Otherwise, keep your
lines writing to the ini file, etc:
Lab 13 - 9
Lab 13 - 9
Lab 13 - 10
Lab 13 - 10
50. Instead of checking sqlcode yourself, you can call of_check_and_report( ) and if it
returns a 0 then call of_commit( ) otherwise call of_rollback( ):
50. Instead of checking sqlcode yourself, you can call of_check_and_report( ) and if it
returns a 0 then call of_commit( ) otherwise call of_rollback( ):
Lab 13 - 11
Lab 13 - 11
Lab 13 - 12
Lab 13 - 12
52. Test your application to make sure changes made did not introduce new bugs, i.e. be
sure you can still connect and get a new claim ID.
52. Test your application to make sure changes made did not introduce new bugs, i.e. be
sure you can still connect and get a new claim ID.
53. Exit the running application and close any open painters.
53. Exit the running application and close any open painters.
Lab 13 - 13
Lab 13 - 13
Objectives:
Objectives:
Override methods
Override methods
Description:
In this lab, you will be partitioning code you initially embedded in the Claims Calculator
window. When you created that window, it was used to demonstrate the various types of
methods you could create. You calculated a claim payment amount with an unmapped
user event, a global function and we left it calculating via an embedded object-level
function. This is mixing Business Logic in with the User Interface partition, which makes
reuse and maintenance more complicated.
Description:
In this lab, you will be partitioning code you initially embedded in the Claims Calculator
window. When you created that window, it was used to demonstrate the various types of
methods you could create. You calculated a claim payment amount with an unmapped
user event, a global function and we left it calculating via an embedded object-level
function. This is mixing Business Logic in with the User Interface partition, which makes
reuse and maintenance more complicated.
Procedure
1.
Open w_claim_calculator.
Procedure
1.
Open w_claim_calculator.
2.
Review the code in the of_calculate( ) function. Notice that the calculation depends
on the type of insurance coverage being Basic or Premium.
2.
Review the code in the of_calculate( ) function. Notice that the calculation depends
on the type of insurance coverage being Basic or Premium.
3.
In the System Tree, right-click over the SybHealth_target and select New
3.
In the System Tree, right-click over the SybHealth_target and select New
4.
4.
5.
5.
6.
Insert a new function into this object named of_calculate that returns a double and has
two arguments, a double, adbl_claim_amt and a string, as_claim_type.
6.
Insert a new function into this object named of_calculate that returns a double and has
two arguments, a double, adbl_claim_amt and a string, as_claim_type.
Lab 13 - 14
7.
7.
8.
8.
9.
Using the System Tree, inherit from n_anc_coverage, creating a new object named
n_basic_coverage. Save this object in the claims.pbl.
9.
Using the System Tree, inherit from n_anc_coverage, creating a new object named
n_basic_coverage. Save this object in the claims.pbl.
Lab 13 - 14
15. Adjust the pasted script for calculating Basic coverage only:
15. Adjust the pasted script for calculating Basic coverage only:
16. What did you just do to the function, since it was created in n_anc_coverage and you
put new code in the descendant? The technical term for this is?
16. What did you just do to the function, since it was created in n_anc_coverage and you
put new code in the descendant? The technical term for this is?
_____________________________________________________________________
_____________________________________________________________________
18. Inherit again from n_anc_coverage. Save this new object as n_premium_coverage in
the claims.pbl.
18. Inherit again from n_anc_coverage. Save this new object as n_premium_coverage in
the claims.pbl.
19. Again, copy the function code from w_claim_calculator of_calculate( ) function and
paste it into that for n_premium_coverages of_calculate( ).
19. Again, copy the function code from w_claim_calculator of_calculate( ) function and
paste it into that for n_premium_coverages of_calculate( ).
Lab 13 - 15
Lab 13 - 15
23. At the top of the script, declare a variable with the type of n_ancestor_coverage.
Name the variable lnv_coverage.
23. At the top of the script, declare a variable with the type of n_ancestor_coverage.
Name the variable lnv_coverage.
24. With an IF statement, determine the value of the is_cover_type instance variable. If
the type is P, assign to lnv_coverage by creating an instance of
n_premium_coverage. Otherwise, create an instance of n_basic_coverage.
24. With an IF statement, determine the value of the is_cover_type instance variable. If
the type is P, assign to lnv_coverage by creating an instance of
n_premium_coverage. Otherwise, create an instance of n_basic_coverage.
25. Locate the line where you called the of_calculate( ) function and make the appropriate
change so that you will be calling the NVOs function.
25. Locate the line where you called the of_calculate( ) function and make the appropriate
change so that you will be calling the NVOs function.
26. After you write the functions return back to the EditMask control, destroy the NVO.
26. After you write the functions return back to the EditMask control, destroy the NVO.
28. Was the destroy statement required? To answer this question, look up
GarbageCollection in WinHelp.
28. Was the destroy statement required? To answer this question, look up
GarbageCollection in WinHelp.
_____________________________________________________________________
Lab 13 - 16
_____________________________________________________________________
Lab 13 - 16
____________________________________________________________________
____________________________________________________________________
31. Run the application to test your work. There is a menu item under Tools to open the
Claim Calculator. To see the Tools menu item, you must have a sheet opened in the
MDI Frame window.
31. Run the application to test your work. There is a menu item under Tools to open the
Claim Calculator. To see the Tools menu item, you must have a sheet opened in the
MDI Frame window.
Lab 13 - 17
Lab 13 - 17
Lab 13 - 18
Lab 13 - 18
Objectives:
Objectives:
Description:
Put data into, and get data from the Message object.
Put data into, and get data from the Message object.
In this lab, you will be adding functionality to the application where the user can doubleclick a claim on the search window, opening that claim for editing. You will be using the
same window you created for a new claim, so modifications will be required there. When
the user double-clicks on a claim, you will need to get information from the DataWindow,
put that data into an NVO, and then open the w_claim_new window, passing the NVO as
input. The w_claim_new will then have to get the NVO from the Message object and use
the contents for its processing. You will also complete the Reports interface. You will add
new menu items for the Reports and call the reports window passing information about
which report to display. This process also uses the Message object.
Description:
The Patient Search functionality on the Claims Search window will also be completed.
You will be getting the patient id from the selected row on w_patient_search and return
that, via the Message object, to a singlelineedit control.
Task Outline:
The Patient Search functionality on the Claims Search window will also be completed.
You will be getting the patient id from the selected row on w_patient_search and return
that, via the Message object, to a singlelineedit control.
Task Outline:
In this lab, you will be adding functionality to the application where the user can doubleclick a claim on the search window, opening that claim for editing. You will be using the
same window you created for a new claim, so modifications will be required there. When
the user double-clicks on a claim, you will need to get information from the DataWindow,
put that data into an NVO, and then open the w_claim_new window, passing the NVO as
input. The w_claim_new will then have to get the NVO from the Message object and use
the contents for its processing. You will also complete the Reports interface. You will add
new menu items for the Reports and call the reports window passing information about
which report to display. This process also uses the Message object.
Lab 14 - 1
Lab 14 - 1
Detailed Instructions
Detailed Instructions
1.
In the System Tree, right-click over the SybHealth_target and select New
1.
In the System Tree, right-click over the SybHealth_target and select New
2.
2.
3.
Click OK.
3.
Click OK.
4.
4.
5.
5.
6.
a. Long
il_claim_id
a. Long
il_claim_id
b. String
is_patient_name
b. String
is_patient_name
Creating an NVO containing only instance variables would be similar to creating what
other kind of PowerBuilder entity?
6.
_____________________________________________________________________
7.
1.
Lab 14 - 2
_____________________________________________________________________
7.
Creating an NVO containing only instance variables would be similar to creating what
other kind of PowerBuilder entity?
Open w_claims_search.
1.
Open w_claims_search.
2.
2.
3.
When the user double clicks over a claim, you want to get the claim_id and patient
name and store it in the instance variables of the NVO you just created.
3.
When the user double clicks over a claim, you want to get the claim_id and patient
name and store it in the instance variables of the NVO you just created.
4.
Expand d_claims_list in the System Tree. Then expand the Controls folder. This
shows you the objects that you placed on that DataWindow object. The A icon
indicates Text objects (as does the _t suffix). The other icon indicates a Column
object.
4.
Expand d_claims_list in the System Tree. Then expand the Controls folder. This
shows you the objects that you placed on that DataWindow object. The A icon
indicates Text objects (as does the _t suffix). The other icon indicates a Column
object.
5.
5.
6.
6.
Lab 14 - 2
7.
You will learn more about reading and writing data in DataWindows in the next
module.
7.
You will learn more about reading and writing data in DataWindows in the next
module.
8.
Save.
8.
Save.
1.
Still in the DoubleClicked event, after you have put the information into the NVO,
you need to place the NVO into the Message object. You do that by calling one of the
withParm functions.
1.
Still in the DoubleClicked event, after you have put the information into the NVO,
you need to place the NVO into the Message object. You do that by calling one of the
withParm functions.
2.
2.
OpenWithParm(w_claim_new, lnv_claim)
3.
OpenWithParm(w_claim_new, lnv_claim)
3.
Lab 14 - 3
Lab 14 - 3
Lab 14 - 4
1.
Open w_claim_new.
1.
Open w_claim_new.
2.
2.
3.
Place some blank lines ahead of the line of code there calling the ue_insert( ) event.
3.
Place some blank lines ahead of the line of code there calling the ue_insert( ) event.
4.
4.
5.
Instead of the receiver instantiating n_claim_info, populate that variable by getting the
data from the Message objects PowerObjectParm property. Write that statement
now.
5.
Instead of the receiver instantiating n_claim_info, populate that variable by getting the
data from the Message objects PowerObjectParm property. Write that statement
now.
6.
Call the PowerScript function IsValid( ) function passing it the lnv_claim variable. If
the reference is not valid then that means the user wants to insert. Call the ue_insert( )
event. Otherwise, instruct the DataWindow to Retrieve( ) passing the NVOs
il_claim_id as an argument.
6.
Call the PowerScript function IsValid( ) function passing it the lnv_claim variable. If
the reference is not valid then that means the user wants to insert. Call the ue_insert( )
event. Otherwise, instruct the DataWindow to Retrieve( ) passing the NVOs
il_claim_id as an argument.
7.
Using Dot Notation, set the Title property of the w_claim_new window to read:
Editing claim for: followed by the patient name that was stored in the NVO.
7.
Using Dot Notation, set the Title property of the w_claim_new window to read:
Editing claim for: followed by the patient name that was stored in the NVO.
8.
Save and test. You have not implemented the update functionality for w_claim_new
yet, so making changes will not be saved to the database. When testing, double-click
a header in the claims search DataWindow. The application will issue an error
message and terminate.
8.
Save and test. You have not implemented the update functionality for w_claim_new
yet, so making changes will not be saved to the database. When testing, double-click
a header in the claims search DataWindow. The application will issue an error
message and terminate.
9.
9.
Lab 14 - 4
11. Fix the code so that double-clicking on a header is properly handled. HINT: Rows
start at 1 in PowerBuilder DataWindows. The header would not be considered to be a
row.
11. Fix the code so that double-clicking on a header is properly handled. HINT: Rows
start at 1 in PowerBuilder DataWindows. The header would not be considered to be a
row.
1.
Open w_patient_search.
1.
Open w_patient_search.
2.
2.
3.
When the user DoubleClicks a row in the Patient Search window, you are going to get
the patient ID, put it into the Message object and when the Claim Search window reactivates, it will get that data out and place it into the Patient ID singlelineedit control.
3.
When the user DoubleClicks a row in the Patient Search window, you are going to get
the patient ID, put it into the Message object and when the Claim Search window reactivates, it will get that data out and place it into the Patient ID singlelineedit control.
4.
4.
5.
5.
6.
Close this Response-type window with the CloseWithReturn( ) function. Pass parent
as the first argument (representing the window) and ll_pat_id as the second argument.
CloseWithReturn( ) also puts data into the Message object:
6.
Close this Response-type window with the CloseWithReturn( ) function. Pass parent
as the first argument (representing the window) and ll_pat_id as the second argument.
CloseWithReturn( ) also puts data into the Message object:
7.
Save.
7.
Save.
8.
Open w_claims_search.
8.
Open w_claims_search.
9.
9.
11. Assign to ll_pat_id the value in the Message objects DoubleParm property.
11. Assign to ll_pat_id the value in the Message objects DoubleParm property.
Lab 14 - 5
Lab 14 - 5
12. Test IF the ll_pat_id > 0 then write that value to the sle_pat_id singlelineedit control.
Cast the data before writing to the singlelineedit control:
12. Test IF the ll_pat_id > 0 then write that value to the sle_pat_id singlelineedit control.
Cast the data before writing to the singlelineedit control:
13. Save and test your work. On Claim Search sheet, click the ellipsis button, select a
patient by double-clicking and make sure the ID is pasted back into the singlelineedit
control.
13. Save and test your work. On Claim Search sheet, click the ellipsis button, select a
patient by double-clicking and make sure the ID is pasted back into the singlelineedit
control.
14. Exit the running application and close any open painters.
14. Exit the running application and close any open painters.
Lab 14 - 6
Using the System Tree, list the names of the report DataWindow objects in the
sybhealth.pbl below:
1.
Using the System Tree, list the names of the report DataWindow objects in the
sybhealth.pbl below:
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
2.
Open d_rpt_patient.
2.
Open d_rpt_patient.
3.
You will note that d_rpt_patient contains two nested DataWindow objects,
d_rpt_insurance_policy and d_rpt_claims. So you really only have two reports for the
application. Nested DataWindows are covered in FastTrack to PowerBuilder, Part II.
3.
You will note that d_rpt_patient contains two nested DataWindow objects,
d_rpt_insurance_policy and d_rpt_claims. So you really only have two reports for the
application. Nested DataWindows are covered in FastTrack to PowerBuilder, Part II.
4.
Close d_rpt_patient.
4.
Close d_rpt_patient.
5.
Open m_master.
5.
Open m_master.
6.
Script FileOpenReports. Remove the code that is currently there. The top level
of a menu cascade should never have code in its Clicked event.
6.
Script FileOpenReports. Remove the code that is currently there. The top level
of a menu cascade should never have code in its Clicked event.
7.
Add two new menu items under FileOpenReports. Name the items &Claims
Summary and &Patient && Claims (use the double ampersand when you want to
display an ampersand in a menu item).
7.
Add two new menu items under FileOpenReports. Name the items &Claims
Summary and &Patient && Claims (use the double ampersand when you want to
display an ampersand in a menu item).
Lab 14 - 6
Script the Claims Summary menu item to open the w_reports sheet passing 1 as the
parm to the Message object. You will want to allow the user to open multiple
instances of w_reports as well:
8.
w_reports
lw_reports
OpenSheetWithParm(lw_reports, 1, w_frame, 0, layered!)
9.
Script the Claims Summary menu item to open the w_reports sheet passing 1 as the
parm to the Message object. You will want to allow the user to open multiple
instances of w_reports as well:
w_reports
lw_reports
OpenSheetWithParm(lw_reports, 1, w_frame, 0, layered!)
Script the Patient Claims menu item to open w_reports, passing 2 as the parm.
9.
Script the Patient Claims menu item to open w_reports, passing 2 as the parm.
11. From the System Tree, right-click over the SybHealth_target and select Full Build.
This is an operation you should be performing periodically throughout development.
Check for a successful Build in the Output pane.
11. From the System Tree, right-click over the SybHealth_target and select Full Build.
This is an operation you should be performing periodically throughout development.
Check for a successful Build in the Output pane.
f.
f.
Lab 14 - 7
Lab 14 - 7
Lab 14 - 8
19. Notice it takes time after you click Patient & Claims before the window appears,
because of the amount of data being retrieved.
19. Notice it takes time after you click Patient & Claims before the window appears,
because of the amount of data being retrieved.
21. On w_reports, add a new unmapped event named ue_postopen. This event returns
(None) and has no arguments.
21. On w_reports, add a new unmapped event named ue_postopen. This event returns
(None) and has no arguments.
Lab 14 - 8
22. Move the code from the Open event to the new ue_postopen.
22. Move the code from the Open event to the new ue_postopen.
23. In the Open event make a call that POSTS the ue_postopen( ) event. Also call the
SetPointer( ) function passing HourGlass! as the argument. Also, call w_frames
SetMicroHelp( ) function passing the string Retrieving data, please wait:
23. In the Open event make a call that POSTS the ue_postopen( ) event. Also call the
SetPointer( ) function passing HourGlass! as the argument. Also, call w_frames
SetMicroHelp( ) function passing the string Retrieving data, please wait:
24. In the ue_postopen( ) event, set the pointer back to Arrow! and set the microhelp back
to Ready at the end of the code.
24. In the ue_postopen( ) event, set the pointer back to Arrow! and set the microhelp back
to Ready at the end of the code.
26. Run the application to test your work. First open the Claims Summary report. When
you open the Patient & Claims report, at least now the user sees the window, and the
hourglass pointer indicating that something is happening versus the way it was earlier.
Also watch the status bar of the MDI frame window.
26. Run the application to test your work. First open the Claims Summary report. When
you open the Patient & Claims report, at least now the user sees the window, and the
hourglass pointer indicating that something is happening versus the way it was earlier.
Also watch the status bar of the MDI frame window.
Lab 14 - 9
Lab 14 - 9
Lab 14 - 10
Lab 14 - 10
Objectives:
Objectives:
Description:
Procedure
In this lab, you will finish the Patient Master-Detail interface. This will require you to
perform two retrieves. The only thing that is somewhat new is the getting of the key from
the row in the master and passing that key to the detail DataWindow control for it to use in
the Retrieve( ).
1.
Open w_patient_master_detail.
2.
Procedure
In this lab, you will finish the Patient Master-Detail interface. This will require you to
perform two retrieves. The only thing that is somewhat new is the getting of the key from
the row in the master and passing that key to the detail DataWindow control for it to use in
the Retrieve( ).
1.
Open w_patient_master_detail.
2.
3.
3.
4.
You will probably need to adjust the Height of the window and the dw_detail
DataWindow control in order to see all columns without scrolling.
4.
You will probably need to adjust the Height of the window and the dw_detail
DataWindow control in order to see all columns without scrolling.
5.
In the Open event of the window, code the retrieve for the dw_master DWC.
5.
In the Open event of the window, code the retrieve for the dw_master DWC.
6.
dw_detail will only retrieve when the user selects a different row in the master
DataWindow. Some users will click rows; some will use the arrow keys.
6.
dw_detail will only retrieve when the user selects a different row in the master
DataWindow. Some users will click rows; some will use the arrow keys.
7.
7.
8.
Write code to get the patient_id from the current row and store it into a long variable
named ll_pat_id. Use a DataWindow data expression instead of the GetItem
functions. Then pass that variable to dw_details retrieve( ):
8.
Write code to get the patient_id from the current row and store it into a long variable
named ll_pat_id. Use a DataWindow data expression instead of the GetItem
functions. Then pass that variable to dw_details retrieve( ):
9.
9.
Lab 15 - 1
Lab 15 - 1
Lab 15 - 2
13. Make note that w_patient_master_detail was not inherited from w_data_sheet, so the
code you add below is not extending what you looked at in step 10.
13. Make note that w_patient_master_detail was not inherited from w_data_sheet, so the
code you add below is not extending what you looked at in step 10.
14. Navigate to the windows ue_save event. Now that we have our own Transaction
object with ready-made functions, the update code will be easier than what you put
into w_data_sheets ue_save.
14. Navigate to the windows ue_save event. Now that we have our own Transaction
object with ready-made functions, the update code will be easier than what you put
into w_data_sheets ue_save.
15. You will only be updating the detail DataWindow. Code w_patient_master_details
ue_save as follows:
15. You will only be updating the detail DataWindow. Code w_patient_master_details
ue_save as follows:
d. If li_ret = -1 then call sqlcas of_rollback( ) function and display a message for
the end user that the update failed.
d. If li_ret = -1 then call sqlcas of_rollback( ) function and display a message for
the end user that the update failed.
e. If you make changes to the detail DataWindow, you will want to re-retrieve
dw_master to refresh its display.
e. If you make changes to the detail DataWindow, you will want to re-retrieve
dw_master to refresh its display.
Lab 15 - 2
17. Navigate to the Open event of the window and script to disable the Export menu item
and toolbar icon.
17. Navigate to the Open event of the window and script to disable the Export menu item
and toolbar icon.
18. Save.
18. Save.
20. The way the application is currently coded, the user must make a change in the Detail
DataWindow and click on the Save icon (or FileSave). What if the user made a
change in the Detail and then used the mouse or arrow keys to change focus to
another row (in the master). Your changes would be lost.
20. The way the application is currently coded, the user must make a change in the Detail
DataWindow and click on the Save icon (or FileSave). What if the user made a
change in the Detail and then used the mouse or arrow keys to change focus to
another row (in the master). Your changes would be lost.
21. Correct the above situation by adding the following code to the LoseFocus event of
dw_detail:
21. Correct the above situation by adding the following code to the LoseFocus event of
dw_detail:
c. If the user wants to save the changes, invoke the windows ue_save( ) event.
Otherwise, return from the event.
c. If the user wants to save the changes, invoke the windows ue_save( ) event.
Otherwise, return from the event.
Lab 15 - 3
Lab 15 - 3
Lab 15 - 4
Lab 15 - 4
Objectives:
Objectives:
Description:
In this lab, you will add client-side sort and filter capabilities to the Patient Master-Detail
window.
Description:
In this lab, you will add client-side sort and filter capabilities to the Patient Master-Detail
window.
Task Outline:
Task Outline:
Lab 15 - 5
Lab 15 - 5
Detailed Instructions
Detailed Instructions
Lab 15 - 6
1.
Open w_patient_master_detail.
1.
Open w_patient_master_detail.
2.
Add a new user event named ue_sort that returns (None) and takes no arguments.
2.
Add a new user event named ue_sort that returns (None) and takes no arguments.
3.
3.
b. Call the PowerScript function SetNull( ) passing the string variable as the
argument.
b. Call the PowerScript function SetNull( ) passing the string variable as the
argument.
4.
4.
5.
Save.
5.
Save.
6.
6.
Lab 15 - 6
7.
On the Tools menu item, add three new submenu items under Claim Calculator: a
separator, &Sort, and &Filter. Assign Sort! to the MenuImage and ToolBarItemName
properties and Sort to the ToolBarItemText property. Assign Where! to the
MenuImage and ToolBarItemName properties and Filter to the ToolBarItemText
property. The drop down should now look like this:
7.
On the Tools menu item, add three new submenu items under Claim Calculator: a
separator, &Sort, and &Filter. Assign Sort! to the MenuImage and ToolBarItemName
properties and Sort to the ToolBarItemText property. Assign Where! to the
MenuImage and ToolBarItemName properties and Filter to the ToolBarItemText
property. The drop down should now look like this:
8.
Script Sort and Filter to invoke ue_sort( ) and ue_filter( ) respectively. Use
PARENTWINDOW and DYNAMIC method calls here as we have yet to create the
ue_filter( ) event (and did not create those events in an ancestor).
8.
Script Sort and Filter to invoke ue_sort( ) and ue_filter( ) respectively. Use
PARENTWINDOW and DYNAMIC method calls here as we have yet to create the
ue_filter( ) event (and did not create those events in an ancestor).
9.
9.
10. Run your application to test sort on the Patient Details window. Click on the Sort
icon on the toolbar. A dialog appears allowing you to drag columns to specifying the
sort order.
10. Run your application to test sort on the Patient Details window. Click on the Sort
icon on the toolbar. A dialog appears allowing you to drag columns to specifying the
sort order.
12. The data will sort. The new row one is not highlighted. The original row 1 still has
focus. Scroll down and you will see that original row one still has the blue highlight
bar.
12. The data will sort. The new row one is not highlighted. The original row 1 still has
focus. Scroll down and you will see that original row one still has the blue highlight
bar.
13. Press F1 to open WinHelp and look up the DataWindow Sort( ) function. Read the
Usage notes to determine how to correct the above issue.
13. Press F1 to open WinHelp and look up the DataWindow Sort( ) function. Read the
Usage notes to determine how to correct the above issue.
14. Exit the running application and get back to the ue_sort( ) event of
w_patient_master_detail.
14. Exit the running application and get back to the ue_sort( ) event of
w_patient_master_detail.
Lab 15 - 7
Lab 15 - 7
19. The SetSort( ) function takes a string where you specify the sort criteria, like
patient_id A. That same logic can be applied for header click-sorting.
19. The SetSort( ) function takes a string where you specify the sort criteria, like
patient_id A. That same logic can be applied for header click-sorting.
20. In the System Tree, expand d_patient_list (the DataWindow object used in
dw_master). Expand the Controls folder. In an earlier lab, you learned how to use
the System Tree to help you code. The DWOs object names are all listed under the
Controls folder. Text (header) objects are named after the column but add the _t
suffix. SetSort( ) needs a column name, the header has that with the addition of _t.
20. In the System Tree, expand d_patient_list (the DataWindow object used in
dw_master). Expand the Controls folder. In an earlier lab, you learned how to use
the System Tree to help you code. The DWOs object names are all listed under the
Controls folder. Text (header) objects are named after the column but add the _t
suffix. SetSort( ) needs a column name, the header has that with the addition of _t.
Lab 15 - 8
a. Boolean
ib_click_sort
b. Char
ic_last_sort_order
ib_click_sort
b. Char
ic_last_sort_order
24. Save.
24. Save.
b. Check that the user clicked on a text object (_t). Other objects can live in the
header band beside text objects. Do this by interrogating if the right-most two
characters of the objects name is _t. Use the Right( ) PowerScript function.
The objects name is referenced as dwo.name, where dwo is another event
argument. Every object you place in a DataWindow object is given a name.
b. Check that the user clicked on a text object (_t). Other objects can live in the
header band beside text objects. Do this by interrogating if the right-most two
characters of the objects name is _t. Use the Right( ) PowerScript function.
The objects name is referenced as dwo.name, where dwo is another event
argument. Every object you place in a DataWindow object is given a name.
Lab 15 - 8
e. Strip off the last two characters (the _t). Use the Left( ) and Len( )
PowerScript functions. This is just one option. You may want to look up
String functions in WinHelp.
e. Strip off the last two characters (the _t). Use the Left( ) and Len( )
PowerScript functions. This is just one option. You may want to look up
String functions in WinHelp.
f.
f.
i.
i.
j.
j.
Lab 15 - 9
Lab 15 - 9
Lab 15 - 10
31. Scroll down to the bottom of the Properties view and enable the ib_click_sort
property.
31. Scroll down to the bottom of the Properties view and enable the ib_click_sort
property.
32. Save.
32. Save.
33. Run the application. Open the Patient Details window and click a header in the
master DataWindow.
33. Run the application. Open the Patient Details window and click a header in the
master DataWindow.
Lab 15 - 10
1.
Open w_patient_master_detail.
1.
Open w_patient_master_detail.
2.
Add a new user event to the window named ue_filter that returns (None) and has no
arguments.
2.
Add a new user event to the window named ue_filter that returns (None) and has no
arguments.
3.
3.
4.
4.
5.
5.
6.
6.
7.
7.
8.
8.
_____________________________________________________________________
9.
_____________________________________________________________________
9.
10. THINK ABOUT IT: SetFilter( ) also takes a string argument, one which you could
build easily by giving the user a window with drop downs and listboxes, etc from
which you take their input and build a string. You might think the built-in Filter
dialog is too complicated for your end-users. Build one of your own:
Lab 15 - 11
10. THINK ABOUT IT: SetFilter( ) also takes a string argument, one which you could
build easily by giving the user a window with drop downs and listboxes, etc from
which you take their input and build a string. You might think the built-in Filter
dialog is too complicated for your end-users. Build one of your own:
Lab 15 - 11
Objectives:
Objectives:
Description:
In this lab, you will write code in the ItemChanged of the DataWindow on w_patient_new,
checking to see that the user has entered a Zip + 4 (a business rule). You will then add a
custom data entry error message in the ItemError event. Finally, you will write a custom
error message in the DBError event of your u_dw DataWindow control.
Description:
In this lab, you will write code in the ItemChanged of the DataWindow on w_patient_new,
checking to see that the user has entered a Zip + 4 (a business rule). You will then add a
custom data entry error message in the ItemError event. Finally, you will write a custom
error message in the DBError event of your u_dw DataWindow control.
Task Outline:
Task Outline:
Lab 15 - 12
Lab 15 - 12
Detailed Instructions
Detailed Instructions
1.
Run the application. After logging in, click FileNewPatient. Click on the Zip
code column and enter 77777. Press the tab key. The cursor will move to the next
column.
1.
Run the application. After logging in, click FileNewPatient. Click on the Zip
code column and enter 77777. Press the tab key. The cursor will move to the next
column.
2.
2.
3.
Open w_patient_new.
3.
Open w_patient_new.
4.
4.
5.
5.
6.
In the CASE of zip, if the data entered (use the data argument of this event) is <> 9,
then code the appropriate return that will reject the value entered and not allow focus
to change. In WinHelp, look up ItemChanged event of the DataWindow for the
proper RETURN code:
6.
In the CASE of zip, if the data entered (use the data argument of this event) is <> 9,
then code the appropriate return that will reject the value entered and not allow focus
to change. In WinHelp, look up ItemChanged event of the DataWindow for the
proper RETURN code:
7.
7.
8.
8.
Lab 15 - 13
Lab 15 - 13
Enter a zip code of 77777 and press the Tab key. You should now see the default
PowerBuilder message box displaying the data entry error. You can create a better
error message that PowerBuilders.
Enter a zip code of 77777 and press the Tab key. You should now see the default
PowerBuilder message box displaying the data entry error. You can create a better
error message that PowerBuilders.
11. Where did the title of the error message (Error accessing data) come from? HINT:
Open the a_sybhealth application object and look at its properties.
11. Where did the title of the error message (Error accessing data) come from? HINT:
Open the a_sybhealth application object and look at its properties.
1.
1.
2.
Put in the same CASE statement that you put in the ItemChanged event.
2.
Put in the same CASE statement that you put in the ItemChanged event.
3.
In CASE zip display a custom message box that tells the user they must enter a Zip
+ 4 value.
3.
In CASE zip display a custom message box that tells the user they must enter a Zip
+ 4 value.
4.
Save and run the application, not closing the painter. Test the same way you did
above.
4.
Save and run the application, not closing the painter. Test the same way you did
above.
5.
You should have received two different error messages, yours and the default
PowerBuilder message.
5.
You should have received two different error messages, yours and the default
PowerBuilder message.
6.
6.
7.
Apply the correct RETURN code to the ItemError event that suppresses the default
PowerBuilder message:
7.
Apply the correct RETURN code to the ItemError event that suppresses the default
PowerBuilder message:
8.
8.
9.
9.
Lab 15 - 14
9.
1.
Open u_dw.
1.
Open u_dw.
2.
2.
3.
The code you will put in this event is common code and does not need to be repeated.
Events can always be extended in the descendants or overridden if needed.
3.
The code you will put in this event is common code and does not need to be repeated.
Events can always be extended in the descendants or overridden if needed.
Lab 15 - 14
4.
b. Issue a message stating that a Database error has occurred, and in the message
box, display the specific Database error number and the text that goes along
with that number. When coding the message box, use the DBError event
arguments.
b. Issue a message stating that a Database error has occurred, and in the message
box, display the specific Database error number and the text that goes along
with that number. When coding the message box, use the DBError event
arguments.
5.
5.
6.
6.
7.
Using the System Tree, right-click over the SybHealth_target and select Search
7.
Using the System Tree, right-click over the SybHealth_target and select Search
8.
8.
9.
The output pane appears and the results display on a Search tab (in PowerBuilder 11).
9.
The output pane appears and the results display on a Search tab (in PowerBuilder 11).
10. There should be two places in the application where youve called update( ).
10. There should be two places in the application where youve called update( ).
11. In the search results, double-click over the line item containing
w_patient_master_detail. That object/event will open in the painter.
11. In the search results, double-click over the line item containing
w_patient_master_detail. That object/event will open in the painter.
12. Because of what you put into the DBError event, you no longer need the ELSE
section of the IF statement. Comment out the unneeded code.
12. Because of what you put into the DBError event, you no longer need the ELSE
section of the IF statement. Comment out the unneeded code.
14. If you wish, you can also re-factor the code in ue_save( ) of w_data_sheet. This is
optional.
14. If you wish, you can also re-factor the code in ue_save( ) of w_data_sheet. This is
optional.
Lab 15 - 15
Lab 15 - 15
Objectives:
Objectives:
Description:
In this lab, you will finish adding update functionality to the application. You still have
three windows, New Claim, New Patient and New Policy that are not saving their data.
These windows are response windows with only a DataWindow control on them, so you
will code their updates in the CloseQuery event. You also have the issue of not being able
to fully delete a claim. You will set the Claim Search DataWindows Update properties so
that its update code is now successful.
Description:
In this lab, you will finish adding update functionality to the application. You still have
three windows, New Claim, New Patient and New Policy that are not saving their data.
These windows are response windows with only a DataWindow control on them, so you
will code their updates in the CloseQuery event. You also have the issue of not being able
to fully delete a claim. You will set the Claim Search DataWindows Update properties so
that its update code is now successful.
Task Outline:
Task Outline:
Lab 15 - 16
Lab 15 - 16
Detailed Instructions
Detailed Instructions
1.
Open w_data_response.
1.
Open w_data_response.
2.
Create a new event on the window named ue_update that returns (None) and has no
arguments.
2.
Create a new event on the window named ue_update that returns (None) and has no
arguments.
3.
Code the event as youve done before, calling dw_datas Update( ) function and if it
returns 1 calling sqlcas of_commit( ) function.
3.
Code the event as youve done before, calling dw_datas Update( ) function and if it
returns 1 calling sqlcas of_commit( ) function.
4.
Save.
4.
Save.
5.
5.
6.
6.
c. In a message box, ask the user if they want to save changes before the window
closes. Give them three buttons, yes, no and cancel. Set the default button to
yes.
c. In a message box, ask the user if they want to save changes before the window
closes. Give them three buttons, yes, no and cancel. Set the default button to
yes.
d. Assign the return from the message box to the li_ret variable.
d. Assign the return from the message box to the li_ret variable.
f.
f.
g. If li_ret = 2 or 3, look up via WinHelp the CloseQuery event and script the
appropriate RETURN codes for those conditions
Lab 15 - 17
g. If li_ret = 2 or 3, look up via WinHelp the CloseQuery event and script the
appropriate RETURN codes for those conditions
Lab 15 - 17
Lab 15 - 18
7.
7.
8.
Save and test your work by adding a new claim, patient and policy. After you add
yourself as a Patient, use the Master-Detail and the filter feature you added to make
sure your code works and you see yourself as a patient. Add a new claim next. Do
not enter the Charged or Paid amounts. When you close and answer yes to save, you
will receive a DBError.
8.
Save and test your work by adding a new claim, patient and policy. After you add
yourself as a Patient, use the Master-Detail and the filter feature you added to make
sure your code works and you see yourself as a patient. Add a new claim next. Do
not enter the Charged or Paid amounts. When you close and answer yes to save, you
will receive a DBError.
9.
In FastTrack to PowerBuilder, Part II, you will learn how to make columns in a
DataWindow required and check for entry before updating the data.
9.
In FastTrack to PowerBuilder, Part II, you will learn how to make columns in a
DataWindow required and check for entry before updating the data.
Lab 15 - 18
10. Exit the running application and close any open painters.
10. Exit the running application and close any open painters.
1.
1.
2.
2.
3.
3.
4.
This DataWindow is not Updatable. You will now correct this issue.
4.
This DataWindow is not Updatable. You will now correct this issue.
5.
5.
6.
6.
7.
7.
8.
8.
9.
9.
10. Set the Where Clause for Updates/Deletes to use Key and Updatable Columns.
10. Set the Where Clause for Updates/Deletes to use Key and Updatable Columns.
11. Click the Primary Key button which will select the appropriate column.
11. Click the Primary Key button which will select the appropriate column.
12. Under Updatable Columns, select all of the columns with the claims_ prefix:
12. Under Updatable Columns, select all of the columns with the claims_ prefix:
15. Run the application again to test your work. Make sure you can now delete a claim.
15. Run the application again to test your work. Make sure you can now delete a claim.
Lab 15 - 19
Lab 15 - 19
Lab 15 - 20
Lab 15 - 20
Objectives:
Objectives:
Description:
You have completed all of the coding tasks for FastTrack to PowerBuilder, Part I. In this
lab, you will take your PBLs /objects and turn them into executables, making the
application ready to deploy to your end users. This process is called Deployment in
PowerBuilder. After you have completed the creation of your executables, you will
prepare the application for installation on an end-users machine.
Description:
You have completed all of the coding tasks for FastTrack to PowerBuilder, Part I. In this
lab, you will take your PBLs /objects and turn them into executables, making the
application ready to deploy to your end users. This process is called Deployment in
PowerBuilder. After you have completed the creation of your executables, you will
prepare the application for installation on an end-users machine.
Task Outline:
Task Outline:
Lab 16 - 1
Lab 16 - 1
Detailed Instructions
Detailed Instructions
Lab 16 - 2
1.
1.
2.
In the System Tree, right-click over the SybHealth_target and select New
2.
In the System Tree, right-click over the SybHealth_target and select New
3.
On the New dialog, select the Project tab, click on Application and click OK:
3.
On the New dialog, select the Project tab, click on Application and click OK:
4.
You are now in the Project painter. Click FileSave As on the menu, saving the
project as p_sybhealth_exe in the sybhealth.pbl.
4.
You are now in the Project painter. Click FileSave As on the menu, saving the
project as p_sybhealth_exe in the sybhealth.pbl.
5.
Click the ellipsis button to the right of the Executable file name property and be sure
you are pointing to your Student directory. Drop the a_ prefix, naming your
executable sybhealth.exe.
5.
Click the ellipsis button to the right of the Executable file name property and be sure
you are pointing to your Student directory. Drop the a_ prefix, naming your
executable sybhealth.exe.
6.
Click the ellipsis button to the right of the Resource file name property and select the
SybHealth.PBR file you have created in the labs.
6.
Click the ellipsis button to the right of the Resource file name property and select the
SybHealth.PBR file you have created in the labs.
7.
7.
8.
8.
Lab 16 - 2
Uncheck the Enable DEBUG symbol property as we have written no conditional code
blocks in this application:
9.
Uncheck the Enable DEBUG symbol property as we have written no conditional code
blocks in this application:
Lab 16 - 3
Lab 16 - 3
Lab 16 - 4
11. Click the Select All button. By doing this, you will be creating one (small) executable
and PBDs (for each PBL) that will be loaded and called on demand. This is the way
you should build most of your applications. There is no need to assign a Resource file
since we did that on the EXE:
11. Click the Select All button. By doing this, you will be creating one (small) executable
and PBDs (for each PBL) that will be loaded and called on demand. This is the way
you should build most of your applications. There is no need to assign a Resource file
since we did that on the EXE:
12. Click on the Version tab and complete details as seen below:
12. Click on the Version tab and complete details as seen below:
13. We are deploying to XP, not Vista, so there is no need to adjust properties on the
Security tab. Also no need to set anything on the Run tab.
13. We are deploying to XP, not Vista, so there is no need to adjust properties on the
Security tab. Also no need to set anything on the Run tab.
Lab 16 - 4
15. Click the Deploy icon (or RunDeploy sybhealth_target). The Output pane will
show the status of the Full Build followed by the creation of the Executables.
15. Click the Deploy icon (or RunDeploy sybhealth_target). The Output pane will
show the status of the Full Build followed by the creation of the Executables.
17. Using the System Tree, count and list below the number of PBLs that make up the
SybHealth application:
17. Using the System Tree, count and list below the number of PBLs that make up the
SybHealth application:
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
23. Double-click your sybhealth.exe. Can you successfully run the application outside of
the PowerBuilder environment?
23. Double-click your sybhealth.exe. Can you successfully run the application outside of
the PowerBuilder environment?
_____________________________________________________________________
_____________________________________________________________________
24. Create a new folder under your Student folder. Name this folder For Deployment.
24. Create a new folder under your Student folder. Name this folder For Deployment.
25. Copy all of the PDBs and the EXE from the locations youve identified above to the
new For Deployment folder.
25. Copy all of the PDBs and the EXE from the locations youve identified above to the
new For Deployment folder.
26. In Windows Explorer, navigate to the For Deployment folder and try to execute the
sybhealth.exe. Were you successful this time? What else do you need to copy to this
folder?
26. In Windows Explorer, navigate to the For Deployment folder and try to execute the
sybhealth.exe. Were you successful this time? What else do you need to copy to this
folder?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Lab 16 - 5
Lab 16 - 5
27. Copy the healthcare3.jpg and the sybhealth.ini file into the deployment folder.
27. Copy the healthcare3.jpg and the sybhealth.ini file into the deployment folder.
28. Test running the application from your executables instead of running the application
from PowerBuilder.
28. Test running the application from your executables instead of running the application
from PowerBuilder.
Lab 16 - 6
1.
The For Deployment folder contains all of your executables as well as other files
necessary for deployment.
1.
The For Deployment folder contains all of your executables as well as other files
necessary for deployment.
2.
In addition to your files, what else do you need to copy to the end users machines?
2.
In addition to your files, what else do you need to copy to the end users machines?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
3.
For this application, one of the items you should have identified above are the
PowerBuilder Runtime files. There is an easy way to package the Runtime files for
deployment, the PowerBuilder Runtime Packager.
3.
For this application, one of the items you should have identified above are the
PowerBuilder Runtime files. There is an easy way to package the Runtime files for
deployment, the PowerBuilder Runtime Packager.
4.
4.
Lab 16 - 6
5.
Select PowerBuilder Components (as this is not a .NET target), de-select all of the
Database Interfaces except for ODBC, and de-select all of the Other Component
options. These options are covered in other PowerBuilder classes. In the Select the
file name property, click the ellipsis button and navigate to your For Deployment
folder. On the Windows Save As dialog, use the icon to create a new folder under
For Deployment named PB Runtime Files. Name the deployment package
PB12Runtime.msi:
5.
Select PowerBuilder Components (as this is not a .NET target), de-select all of the
Database Interfaces except for ODBC, and de-select all of the Other Component
options. These options are covered in other PowerBuilder classes. In the Select the
file name property, click the ellipsis button and navigate to your For Deployment
folder. On the Windows Save As dialog, use the icon to create a new folder under
For Deployment named PB Runtime Files. Name the deployment package
PB12Runtime.msi:
6.
6.
7.
In Windows Explorer, verify the existence of the MSI (Microsoft Installer) file. This
file contains the core runtime files that will interpret your executables.
7.
In Windows Explorer, verify the existence of the MSI (Microsoft Installer) file. This
file contains the core runtime files that will interpret your executables.
8.
Click Done on the Runtime Packager dialog after you have completed the above step.
8.
Click Done on the Runtime Packager dialog after you have completed the above step.
9.
You would also need to make sure the end users had the SybHealth ODBC DSN
(Data Source Name) set up on their machines as you were instructed to do in Lab 1.
9.
You would also need to make sure the end users had the SybHealth ODBC DSN
(Data Source Name) set up on their machines as you were instructed to do in Lab 1.
10. Ideally, you should get a machine that had a brand new Windows installation, and test
your application installation in such an environment. There are many things that one
has to remember to copy in a production application: database client software/drivers,
help files, ActiveX/OLE controls, images, etc.
10. Ideally, you should get a machine that had a brand new Windows installation, and test
your application installation in such an environment. There are many things that one
has to remember to copy in a production application: database client software/drivers,
help files, ActiveX/OLE controls, images, etc.
11. To get the authoritative checklist for PowerBuilder deployment, you need to open the
PowerBuilder HTML books (StartAll ProgramsSybasePowerBuilder
12.0Compiled HTML Help File. Once opened, select the Contents tab. Under the
Application Techniques book there is a folder called Deployment Techniques.
11. To get the authoritative checklist for PowerBuilder deployment, you need to open the
PowerBuilder HTML books (StartAll ProgramsSybasePowerBuilder
12.0Compiled HTML Help File. Once opened, select the Contents tab. Under the
Application Techniques book there is a folder called Deployment Techniques.
12. Under Chapter 35, there is a section called Delivering your application to end users.
Click that section.
12. Under Chapter 35, there is a section called Delivering your application to end users.
Click that section.
Lab 16 - 7
Lab 16 - 7
13. You will see the Installation Checklist. This information (at least the location of this
information) needs to be committed to memory. The document contains hyperlinks
that show you other pages that list the runtime files (which were gathered by the
Runtime Packager and put into the MSI file) as well as their location (should you
choose not to use the Runtime Packager) and a wealth of other information. Spend
some time looking at this document when you get back to your office.
13. You will see the Installation Checklist. This information (at least the location of this
information) needs to be committed to memory. The document contains hyperlinks
that show you other pages that list the runtime files (which were gathered by the
Runtime Packager and put into the MSI file) as well as their location (should you
choose not to use the Runtime Packager) and a wealth of other information. Spend
some time looking at this document when you get back to your office.
14. The creation of executables is where PowerBuilder stops. How you get the
executables out to the end user is your decision. Some options you have:
14. The creation of executables is where PowerBuilder stops. How you get the
executables out to the end user is your decision. Some options you have:
d. Take the Moving to PowerBuilder 11 course and learn about .NET Windows
Form Target types, which include a Smart Client option where your
application could be deployed to your IIS Web Server (or File or FTP Server),
and your end users could execute or install by clicking a hyperlink on a
provided Web page.
d. Take the Moving to PowerBuilder 11 course and learn about .NET Windows
Form Target types, which include a Smart Client option where your
application could be deployed to your IIS Web Server (or File or FTP Server),
and your end users could execute or install by clicking a hyperlink on a
provided Web page.
15. Final thoughts: You have completed FastTrack to PowerBuilder, Part I. There is
much more to learn about the PowerBuilder environment. This class has been part of
a two-part series. FastTrack to PowerBuilder, Part II will take this same application
and add some of the following features:
15. Final thoughts: You have completed FastTrack to PowerBuilder, Part I. There is
much more to learn about the PowerBuilder environment. This class has been part of
a two-part series. FastTrack to PowerBuilder, Part II will take this same application
and add some of the following features:
a. Tab controls/pages
a. Tab controls/pages
b. Advanced controls: Tree Views, List Views, Rich Text, OLE, etc.
b. Advanced controls: Tree Views, List Views, Rich Text, OLE, etc.
e. DataStores
e. DataStores
f.
f.
h. XML in PowerBuilder
h. XML in PowerBuilder
i.
i.
j.
j.
16. We recommend you take this knowledge home, use PowerBuilder at your job for
about 2 or 3 months and then come back and take Part II. Check the Sybase
Education web site for all of our PowerBuilder offerings.
Lab 16 - 8
16. We recommend you take this knowledge home, use PowerBuilder at your job for
about 2 or 3 months and then come back and take Part II. Check the Sybase
Education web site for all of our PowerBuilder offerings.
Lab 16 - 8
*DEV134-90-1200-10-LW-S*
Printed In Canada
*DEV134-90-1200-10-LW-S*
Printed In Canada
DEV134-90-1200-10
DEV134-90-1200-10