| Search Locate Previous Next | Contents |
When preparing an application for shipping, there are three things you might consider doing to get it out of the blocks a little faster, and to economise on disk space for your installation set.
Setting a Startup Banner
This is a new (until recently undocumented) trick which came in with Dyalog 7.2 and 8. It allows you to get a startup banner running almost instantly, which you can kill when the main application has loaded.
First, use Causeway as normal to make a pretty startup screen (set the form style to Banner) such as:
Snap it to the clipboard as a bitmap (click on it, then press Alt+PrintScrn) and save it as a bitmap file with Paintbrush. To save a little space, use a package such as Paintshop Pro to save it as a Windows RLE file (in 16 colours). Then add a new string value greet_bitmap to the Dyalog-8 section in the Registry (look down the trail HKEY_CURRENT_USER, Software, Dyadic, Dyalog APL/W 8) with the value .\banner.rle. For Dyalog 7.2, just add a line greet_bitmap=.\banner.rle to the APL.INI file. When you start your application proper, the Go function will need to kill off the banner with:
2 NQ'.' 'GreetBitmap' 0
You can do this as the first thing in the LX, or leave it as a Post-Create action on the main form. You might even want to set it as the action on a timer on a very fast machine your users might not get time to admire the picture, or to read your copyright notice!
Sleeping Forms
If you have built any Causeway forms with more than 10 or so controls, you will have begun to notice the time taken between CPro.Call and the form becoming visible. On the main application dialogue this does not matter too much, but if you constantly call modal child forms you will need a way to get them on screen more quickly. The following technique can be used to build them once only, and from then on simply hide and show them (refreshed with the latest data) as required.
Two things to note here:
#.CPro.Sleep. This has the effect of hiding the form and turning off all automatic refreshing of data. This is essential, as fields on the form might be watching local variables in a function no longer on the stack! The event must then be rejected to prevent the form from subsequently closing itself.
You can do this for as many forms as you like, including the main application. In this case, you should make sure that you save the workspace with the form still in place, but asleep, i.e. do not run CPro.Clear before you save the final copy.
We must now add some logic to the calling function to make the form first time around, and then just recall it. Here is the code for Go and Log, suitably modified:
Go;fm 2 NQ'.' 'GreetBitmap' 0 :If 0=½fm#.CPro.Id'MAIN' #.CPro.Call dbx_main © 1st time in :Else #.CPro.Recallfm :End
Log inx;log;name;fm © Update incident log for this record loginxlog © Add a new entry for today log®þ(cal_ts 3TS)'' nameinxnames © Reuse sleeping form if available fm#.CPro.Id'LOG' :If 0¹½fm res#.CPro.Call dbx_log :Else res#.CPro.Recallfm :End © Update with new data unless <Cancel> was pressed :If res¬0 (inxlog)log :End
CPro.Id returns the true names of all extant objects with a given group id in this there will be either none or exactly one. If the result was empty, we simply call the form as normal. If CPro.Id returned something, we recall the first item on the list. Naturally, both CPro.Call and CPro.Recall can take a left argument and return a result in exactly the same way.
If you want to make sure your form is really sleeping (and has not completely vanished from the system):
#.CPro.Forms '#.CPro.Class.Root.Control.FM44' © (untitled)
This will list all current forms, including sleeping ones, commented with their titlebar and surrounded with quotes to make it easy for you to modify the line in the APL session and explore the raw Gui aspects of the form.
Clearing Unused Classes
Causeway is shipped with a full set of classes, some of which are quite complex and take a significant amount of workspace. Before you finally ship your application you can use dbx.enum to remove any classes which it does not require (this assumes that all variables in this namespace are dialogue boxes):
renum;nl © List all classes used in all variables in this namespace © Assumes that everything it finds is a dialogue box! nlNL 2 ª r'' :If 0<½nl r(®/OR¨nl)[;IO] :End )cs #.Class EX ¨Classes~#.dbx.enum © Remove unused classes #.CPro.Build © Regenerate Causeway's class list
You can easily add classes back in with Class.GetCls 'xx' but do remember to rerun #.CPro.Build after any such change to the current class list.