310 likes | 518 Views
Session No. E179 Advanced Infomaker With The Help Of Its Friend Powerbuilder. Terry Dykstra Database Administrator Canadian Forest Oil Ltd. Calgary, AB tddykstra@forestoil.ca. Advanced Infomaker With The Help Of Its Friend Powerbuilder. Customizing Infomaker. Three methods
E N D
Session No. E179Advanced Infomaker With The Help Of Its Friend Powerbuilder Terry Dykstra Database Administrator Canadian Forest Oil Ltd. Calgary, AB tddykstra@forestoil.ca
Customizing Infomaker • Three methods • Custom formstyles • Modifying imstyle9.pbl • Modifying the environment
Custom Form Styles • What is a custom form style? • A window + A menuWindow needs to be saved with a comment starting with:‘Style:’ …..
Freeform Gridstyle One-to-many Many-to-one dw_freeform dw_grid; dw_freeform dw_master_12many; dw_detail_12many dw_master_many21; dw_detail_many21 Custom Form Styles Datawindow control naming conventions
Custom Form Styles Other rules • Command buttons on forms use “Actions” • An “Action” = public function on the window
Custom Form Styles Demo 1 Standard Formstyle
Custom Form Styles Demo 1 • PB versus IM library painter • Quick build using freeform w_form1 • Add an “Action” • Save using comment ‘style:demo1” • Build a form in IM • Notice that SQL painter gets invoked automatically
Custom Form Styles • Non standard forms • Using non standard dw-control naming convention • No need to code SQLCA • IM will add code automatically: • call super::opendw_drilldown.SetTransObject(sqlca)dw_drilldown.Retrieve()
Custom Form Styles • Non standard forms • Two functions are automatically created: • Close() • Print_setup()
Custom Form Styles Demo 2 Non Standard Formstyle
Custom Form Styles Demo 2 • Quick build using w_drilldown • Notice the following in PB: • No code in open event of w_drilldown • Notice the following in IM: • The SQL painter does not get invoked • In the IM form code has been generated automatically
Modifying Imstyle9.pbl • What is imstyle9.pbl? • Class library • Determines the functionality of executables created • Does not affect the development environment, except for forms
Modifying Imstyle9.pbl • Why modify imstyle9.pbl? • Provide additional functionality, e.g.: • custom saveas(xml!) • e-mail • easy filter screen • Work around bugs, issues, e.g.: • groupcalc() after retrieve()
Modifying Imstyle9.pbl • What are the limitations? • Cannot modify the default application script • Cannot modify the default project. Creates 1 exe using machine code • No pbd, pbr • but you can use SetLibraryList() in w_pbstyle_ancestor_frame
Modifying Imstyle9.pbl • What are the limitations cont’d? • No dynamic assignments, e.g.: • dw_1.dataobject = “d_myreport” • Upgrading to newer version of Infomaker requires you to redo all your work in the new imstyleX.pbl. Get PBDelta (www.pbdr.com) • No global variables • No global external function declaration
Customizing Imstyle9.pbl Demo 3 Easy Filter / Saveas (XML)
Modifying The Environment • What they did not teach you at “Sybase University” • Disclaimer:This is totally unsupported!No guarantee this will work in the futureProceed with caution!
Modifying The Environment • Understanding toolbars • Where are toolbar settings stored? • [Hkey_current_user\Software\Sybase\Infomaker\9.0\Toolbar] • Toolbars are identified by numbers • Icons on the toolbar are in the ‘Items’ string value • Default toolbars might not be shown in the registry
Infomaker 1000 Powerbar 1004 Library 1007 Report 1010 Form Powerbuilder 1000 Powerbar 1011 Library 1006 Datawindow 1037 Window Modifying The Environment • Understanding toolbars
Modifying The Environment • Understanding items on the toolbar • 3 or 4 digit number • -1 for separator • Examples: • 1468: tab order • 1476: picturehyperlink • 1614: export
Modifying The Environment • Understanding items on the toolbar cont’d • Many will crash IM, e.g. 1076: project • Others will fail, e.g. 1618: Import • Some will do nothing, e.g. 1622: check in
Modifying The Environment • Understanding layouts • Where are default layout settings stored? • [Hkey_current_user\Software\Sybase\Infomaker\9.0\layout\default] • Where are custom layout settings stored? • [Hkey_current_user\Software\Sybase\Infomaker\9.0\layout\form] • [Hkey_current_user\Software\Sybase\Infomaker\9.0\layout\datawindow]
Modifying The Environment • Changing layouts • Borrow the default layout from PB Window registry • Apply to the custom IM form layout • Magic happens: you can now write code in IM forms!
Modifying The Environment • Changing layouts • Limitation: • When you create a new form in IM, you must use the default format.If you try to build a form using the custom (ie script enabled) format, it will fail!
Debugging Infomaker • Default Application Open script: • window w_localToolBarText=TrueExeName="xim.exe"IniName="xim.ini"….. • connect;if sqlca.sqlcode = 0 thenOpenWithParm(w_local,ExeName,"w_pbstyle_frame")else…..
Debugging Infomaker • There is no w_pbstyle_frame in • imstyle9.pbl or • the Infomaker user’s pbl • It exists in the executable created by Infomaker!
Debugging Infomaker • Include the exe in your library list • The target needs to include: • yourimwork.pbl • imstyle9.pbl • yourimwork.exe • Now you can debug your code • You can even look at the code in the exe!