SIMPOL Documentation

Using the Special Features

There are a number of special features that can provide more user-friendly and powerful applications and which are included in the design of the dataform1 family. In this section we will discuss these features.

The onfill Event

The list types, dataform1combo and dataform1list both include a special event called onfill. What this event does is that at the point where the code would normally fill the list of the combo or list box, if this event has a handler assigned, it will instead call that handler. This gives the programmer the ability to fill the list themselves, potentially using content that would otherwise be difficult to define in the normal approach.

[Note]Note

It is important to note here that the onfill event is normally only called when the form is loaded.

The Drop List For Edit Controls

The dataform1edittext control has a special feature that may be familiar to some from the technique in web browsers. Namely, in the edit control while typing suddenly a list will drop down containing related content that had been typed into the box in the past. As the user types, it filters the content such that the beginning of each list entry matches the content that has been typed into the box. The user can then select an item from the list using the mouse, or in our case tab into the control and use the arrow keys to go up and down the list. As they change entries in the list, the text in the edit control is updated to match the entry. When they tab to the next control, the list vanishes.

This sort of functionality is available to every dataform1edittext control. The list content must be retrieved from a database table. This feature cannot be stored in the form definition when it is saved, it must be added after the form has been loaded. To use it, call the enabledroplist() method. This method takes the following parameters:

  1. boolean enable

  2. type(db1index) index

  3. integer activationcharcount

  4. integer listheight

  5. integer maxsearchentries

  6. integer error

To turn on the functionality, the method must be called with the enable parameter set to .true and the index parameter must be a valid index object for the index of the table on which to search. The remaining parameters are optional and have usable default values. The error parameter should always be supplied and tested before making use of the functionality. The names of the parameters should make clear what they do, but here is a brief description anyway:

  • activationcharcount – This setting determines how many characters must be typed into the control before the search functionality is activated. If you have a large table, it may be worth sticking to the default of 2 characters or even increasing it slightly.

  • listheight – This value determines how tall the list box will be. It will be located directly below the edit control and will be the same width as the edit control. The list cannot extend beyond the form height and any value that causes this will be automatically adjusted.

  • maxsearchentries – This is a very useful setting that allows the programmer to limit the number of successfully found matching entries. This should be set to some useful value in the range 20-100 probably. It prevents lag while the searching is carried out. Since the user can simply type another character to search again with a finer filter it is no burden to keep the list size low.

Using a Query to Fill a Detail Block

The dataform1detailblock normally must be linked to the master table of the form. There is a new mode that has been added to allow an unlinked detail block to be managed by the programmer. The detail block can be filled using a query. This can be very useful to see the current status of a selection of the data. For example: unfulfilled jobs, uncleared bookings, completed jobs, open orders, etc. These could then be further filtered to show only those from today, the last hour, the past week, etc.

To use the data grid in this way, call the setparams() method and assign the usequery parameter to .true and the whereclause to the WHERE clause that you wish to be applied to the master table of the detail block. The call the runquery() method, passing in the error parameters (so that you can see if your query was valid or not). Once the query has been run, the result set will be stored and the first page of the detail block will be filled. The SQL92 syntax information can be found in the section called “Using SQL92 in SIMPOL”.