Sw4   >   Configuration   >   Configuration (All Contents)
The StudioWorks application's startup settings are controlled by the startupsettings.txt file located in the APP/startupitems folder.
The startupsettings.txt file is optional. You will only need to create the file if you want to change default settings, preset properties, or control the logon process of the end users.By default StudioWorks uses the last saved logon settings when an StudioWorks application is reopened. You can force an StudioWorks application to always use specific logon settings each time it is opened. To do so you add a logon property group to the APP/startupsettings.txt file.
The following are some examples of a logon properties group that could be added to the startupsettings.txt file.
Logon settings for logging onto an Omnis data file located in the user's APP/data folder.
logon {
damname = OMSQLDAM ;
hostname = APP/data/localdatafile ;
pingdatabase = FALSE ;
}
Logon Settings for logging on as the tables owner to a FrontBase database located on a server on the local area network.
logon {
damname = FRONTBASEDAM ;
hostname = 192.168.1.7 ;
databasename = LiveData ;
tablesownerlogon = TRUE ;
pingdatabase = TRUE ;
}
Be sure to include the ; semi-colon character after each property. The semi-colon is the delimiter.
An StudioWorks application can be configured to automatically sign-in the client when the main library is opened. The primary reason for having this feature is to be able to open a StudioWorks Omnis web application on a server without user intervention. The other reason you might do this is to save the user from needing to enter their name and password in the
window each time they open a low security application.To configure the StudioWorks application for auto sign-in you need to do two things:
To create the autosignin.txt file:
To modify the startupsetting.txt file:
constants {
autosignin = TRUE ;
}
Be sure to include the ; semi-colon character after each property. The semi-colon is the delimiter.
A StudioWorks application can be configured to run as an Omnis web server app.
When running on a web server, the StudioWorks application needs to startup without user intervention and in the event of an error the web app must not halt code execution with an OK message or a modal prompt window. Doing so would halt the Omnis application running on the server. HTTP requests being sent to the Omnis web app server would not be processed. The server administrator would need to use remote desktop software (VNC) to connect to the server, click the OK button, so that the code would continue. Not a good thing.
To configure an StudioWorks application to run as a web application need to modify the startupsetting.txt file:
constants {
autosignin = TRUE ;
appmode = web;
}
Be sure to include the ; semi-colon character after each property. The semi-colon is the delimiter.
With the appmode set to web the StudioWorks framework does the following when the application is opened:
You must also configure the Logon Settings and Auto Sign-In if you set the appmode to web.
If you are instantiating the oEmail object using the Startup_Task task variable eml you should set the applicable oConstants properties either by overridding and setting them manually in the oConstants object in your main library, or by setting them from the startupsettings.txt file.
To set the contants which apply to oEmail in your startupsettings.txt file you will need to include a constants group with properties and values as follows:
constants {
SysAdminEmailAddr = TheSysAdminEmailAddress ;
SysAdminFormalName = TheSysAdminFormalName ;
SMTPServer = TheSMTPServerName ;
}
Example properties and values:
constants {
SysAdminEmailAddr = support@vencor.ca ;
SysAdminFormalName = Vencor Support ;
SMTPServer = mail.vencor.ca ;
}
Alternately you can override the following methods in oConstants of your main library and return the values you want to use for your application.
The StudioWorks files are stored in a specific folders and files structure. Developers can change the folders and files struture but it is recommended that you stick with the default structure while you are writing your first StudioWorks application. Later on when you are ready to release the application you will have more experience with StudioWorks and it will be much easier for you to make a change to the default folders and files structure.
For purposes of documentation, StudioWorks refers to three different root folders:
The APP folder can be any name you or your user want to name it. Moving or renaming the folder will have zero impact on your StudioWorks application.
Enclosed in the APP folder you may find the following folders and files.
Enclosed in the PREFS folder you may find the following StudioWorks related folders:
The StudioWorks default folders configuration can be controlled in two places.
You can change the StudioWorks default folder names by adding a paths properties group to the startupsettings.txt file. The following is a sample of what you could include in the startupsettings.txt file:
paths {
OmnisStartupFolderName = My Application Name ;
PreferencesParentFolderName = My Application Name ;
}
The name of the preferences folder for your StudioWorks app will default to the $name property of your main library. If you want the preferences folder for your StudioWorks app to be a nicer looking name add an $:AppName property method to your main library Startup_Task and return the actual name of your application from that method. The oPaths object will use the return value for your StudioWorks app's preferences folder name.
; $:AppName method - add to main library Startup_Task.
Quit method 'My App Name'
The oConstants property method $:AppLibsList returns a list of libraries to be included in the application. By default this method returns a list of the following libraries:
There might be libraries in the studioworks folder which you do not want included in your application. The $:AppLibsList method lets you control the libraries which are included in your application.
It is recommended that you structure your StudioWorks application as follows:
; Build a list of open libraries used by the application in the order of: prefs, main, libraries, modules, shared. (not utilities)
; Return a list of all the libraries inside the APP folder and the studioworks folder . List is defined using sAppLibs_listdef.
Do inherited Returns AppLibsList
; Select the libraries which are part of this application.
; Deselect all lines.
Do AppLibsList.$search(kFalse)
; Select the main and module libraries.
Do AppLibsList.$search($ref.ismainlib=kTrue,1,0,1,0)
Do AppLibsList.$search($ref.isappmodulelib=kTrue,1,0,1,0)
; Select the SW shared libraries to include in the app.
Do AppLibsList.$search(low($ref.libname)=low('swcSysAdmin4'),1,0,1,0)
; Select the SW core libraries to include in the app.
Do AppLibsList.$search(low($ref.libname)=low('swBase4'),1,0,1,0)
Do AppLibsList.$search(low($ref.libname)=low('swGui4'),1,0,1,0)
Do AppLibsList.$search(low($ref.libname)=low('swIcons4'),1,0,1,0)
Do AppLibsList.$search(low($ref.libname)=low('swRefs4'),1,0,1,0)
Do AppLibsList.$search(low($ref.libname)=low('swReports4'),1,0,1,0)
; Remove the non-selected libraries.
Do AppLibsList.$remove(kListKeepSelected)
Quit method AppLibsList
The above steps may already be setup in your application. You might just have to modify the $:AppLibsList method to suit your application.
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