Search Locate Previous Next Contents

How to Make a Set of Tabbed Subforms

The final few sections of this tutorial cover some odds and ends which we did not need for our sample application. Tabbed dialogues are conventional for setting preferences, although when overdone in Word97 style they can be totally confusing – try to stay with a single row of tabs if at all possible! Here is the kind of layout that makes some sense:


There are a couple of tricks to look out for – the Close button must be placed in exactly the same spot on both subforms, so make the first and copy it to the second, as shown below.


      'tsf' Dbx 'dbx.pref1'
Dialog box dbx.pref1 updated
      dbx.pref2„dbx.pref1
      Dbx 'dbx.pref2'
Dialog box dbx.pref2 updated
      Dbx 'dbx.prefs'
Dialog box dbx.prefs updated
     CPro.Call dbx.prefs

By default, the last form opened gets its tab to the front. To give focus to the first one, set up the event-action table on the parent form like this:

     Disp dbx.prefs[;1 2 5]

ÚÎÎÂÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ

ÛFMÛPreferencesÛÚÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛ

Û Û ÛÛBehaviourÛÚÎÎÂÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÌÛÛ

Û Û ÛÛ ÛÛCRÛÛsf„’Make¨dbx.pref1 d... Û{}ÛÛÛ

Û Û ÛÛ ÛÃÎÎÏÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÝÛÛ

Û Û ÛÛ ÛÛCRÛÛ(œsf) ’Do ‘ToFront’ Û{}ÛÛÛ

Û Û ÛÛ ÛÀÎÎÁÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÙÛÛ

Û Û ÛÃÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝÛ

Û Û ÛÛLocals Û{sf} ÛÛ

Û Û ÛÃÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝÛ

Û Û ÛÛStyle Û{Dbx} ÛÛ

Û Û ÛÀÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛ

ÀÎÎÁÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ

... obviously you could record the state the user left these in and re-open the dialogue at the correct tab.

Placing the Subforms in a Region
It is not essential to have the tabbed forms occupy the entire parent form, and you might want to make your dialogue look more like a standard Windows95 property box:

This example uses a ‘Containing region‘ on the main form, in addition to the obvious <OK> and <Cancel> buttons. The region has as one of its properties a list of dialogue-box definitions to be added as its children – these automatically occupy the entire available space, but are now constrained by the inner container rather than the entire form.

Here is the definition which produced the simple example shown above:

      Disp dbx.prefsub[;1 2 5]

ÚÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ

ÛFM ÛPreferencesÛÚÂÌ Û

Û Û ÛÛÛÛ Û

Û Û ÛÀÁÙ Û

ÃÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ

ÛEN ÛOK ÛÚÂÌ Û

Û Û ÛÛÛÛ Û

Û Û ÛÀÁÙ Û

ÃÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ

ÛQT ÛCancel ÛÚÂÌ Û

Û Û ÛÛÛÛ Û

Û Û ÛÀÁÙ Û

ÃÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ

ÛRGNÛ ÛÚÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛ

Û Û ÛÛSubformsÛÚÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛÛ

Û Û ÛÛ ÛÛExpressionÛdbx.pref1a dbx.pref2aÛÛÛ

Û Û ÛÛ ÛÀÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛÛ

Û Û ÛÀÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛ

ÀÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ

Clearly, this gives you much more flexibility in designing this kind of ‘notebook’ interface – you could even have several sets of related tabbed boxes in the same parent form, or a radio-button group on the left which determined the set of notebook pages shown in the container on the right. In general this will be less confusing to the user than multiple banks of tabs, and is very much better than offering a scrolling tab-bar.

There is an example dbx.prefsubs in the Tutor namespace which makes this type of compound selector:


You might like to experiment with this layout, for example by right-aligning the tabs on the subforms, to produce a setup dialogue which copes well with several sets of related options.



Continue to: How to Set up MDI Children
© Copyright Causeway Graphical Systems Ltd 2001