Tip, July 2002 Using a Script to Automatically Run 'Fit Window to Form' If you prefer to tile your Inmagic® DB/TextWorks® or CS/TextWorks Menu screens, Query screens, Edit windows, Display windows and Report windows, rather than maximising them to take up the entire workspace, you might like to consider adding a simple script to them. By default, TextWorks preserves the window size and position of the form, menu or query screen that you opened last, which can sometimes mean that you end up with words or images hidden from view. The script that follows overcomes this situation by automatically running the equivalent of clicking on Window > Fit Window to Form every time you open a menu, query screen or form. To set up the script, open the designer for the relevant form, screen or menu, then click on Tools > Screen Script or Tools > Form Script (depending on whether the item is a form, a screen or a menu). Check that the script language is set to JScript and then, in the Script area, type this short script (exactly as it appears below, remembering that JScript is case sensitive): function onFormOpen() If you prefer to use VBScript rather than JScript, the coding is slightly different: sub onformOpen() Next, Click on OK and save the item. The scripting is done! If you find this script useful and want to add it to a number of forms or screens, it might be worth saving the lines of script as a text file on your desktop, so you can paste it quickly into the design window whenever you come across an item that needs it. |
||