Sw4   >   Configuration   >   Main Library Startup_Task
The main library Startup_Task is the control center of your StudioWorks application.
When opening a StudioWorks application, the main library startup task $construct method has 2 important jobs to complete before anything can happen:
Once the StudioWorks libraries are open and the error handler has been initialized the rest of the code can execute normally.
The oOpenLibraries object class is used by the main library Startup_Task to open the StudioWorks core libraries. The oOpenLibraries object class must be copied from swBase4 to the main library.
There is a problem during startup with handling errors:
One solution is to open an OK message to notify the user of the error. The problem with this solution is that if the application is being used as an Omnis web app, the OK message will halt the web server app. (not a good thing.)
The solution which we have opted for in StudioWorks is to send the error to the trace log and then open the trace log. This solution is only used for errors that occur during startup before the StudioWorks libraries are open and the error handler has been initialized.When you start a new StudioWorks application most of the main library Startup_Task task variables point to object classes in the you main library which are subclass from objects in the StudioWorks core libraries (swBase4, swGui4, swReports,...).
There comes a point in your StudioWorks application development where you will want to add or modify a method in one of the key objects. In order to do that you will need to override an existing method or add your own method to the subclass object in your main library. The following is an example for adding a custom method to the oFunctions object.
Do fn.$testMethod()
If you want to change a superclass method, do the following steps.
; Sample code if the superclass returns true or false
Do inherited Returns FlagOK
If FlagOK
; Enter your custom code here
End If
Quit method FlagOK
; Sample code if the superclass returns a value
Do inherited Returns Value
If not(isnull(Value))
; Enter your custom code here
End If
Quit method Value