KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D 6.5 Default window titles
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: May 21, 1999

4D 6.5 includes a new "Open form window" command that is a very convenient way to open a window. With this command, you do not use parameters to specify the coordinates of the window, or the window title. In comparison, using the "Open window" command, you must specify four coordinates for the window, and the window won't have a title unless you specify it in a parameter. The new "Open form window" command calculates the size to display the window based on the window sizing options stored with the form properties. It also takes the window title from the form properties. And by default, the window includes a working close box. To get a functioning close box with the older command, you need to create a close box method, and specify that method's name as a string in a parameter.

This default window title is a new feature introduced in version 6.5. Here's how to set the title. While you have the form open in the Form Editor, use the Display item of the Form menu. Select "Property List" from the hierarchical menu. This opens the new 4D 6.5 Property List window, where you can view and edit the form's various specifications. Near the top of this list, in the "Form Properties" section, you'll see a "Window Title" entry where you can type in a default title for the window. This title is then stored together with the form. (Alternately, while you have the form open in the Form Editor, you can access the revised "Form Properties" dialog from the Form menu, just as you did in 4D V6. The entry area for Window Title is in the General page of this dialog.)

You can enter 31 characters for the default window title. There are some useful tricks that can be used to make it more versatile.

You can use the new 4D 6.5 dynamic table titles feature in the title. This is a special syntax where, instead of directly typing in the name of the table, you type in a special code that creates an indirect reference to the table by its number. 4D will then replace this with the name of the table stored in the Structure Editor. If you use this syntax, if you should later decide to rename the table, the window title will automatically self-adjust to the new table name -- you won't have to make a separate revision to the window title in the code.

As an example, let's suppose you are displaying an output form, and you want to display a title such as "People: 10 of 12". When you don't know in advance how many records will be in the table or in its current selection, how can you get that in the default window title, which requires you to type in static text? You can accomplish this by using encapsulated 4D variables in the title. You'll need to use two process variables for this. In our example, we'll use a longint variable "nSelRcds" to hold the number of records in the current selection, and another longint variable "nRcds" to hold the number of records in the table. You'll need to make sure that any code that changes the number of records in the table or in the current selection updates the values of these variables. Let's suppose that the People table is the first table in our database. Here's exactly what you should type for the default window title:

<?[1]>: <nSelRcds> of <nRcds>

When you use encapsulated variables in the default window title, if they are not string variables, 4D automatically converts them to strings. By using encapsulated variables, the resulting window title can be a maximum of 80 characters in length.

The new 4D 6.5 "GET FORM PROPERTIES" command can return the values of the various properties of a form, including its default window title.