next up previous contents
Next: Writing the Panel Handlers Up: Customizing the Window Creation Previous: Customizing trial_ui.h   Contents

Customizing trial_cui.c

If the window is custom then copy trial_ui.c to trial_cui.c. Now perform the following changes to trial_cui.c.

1.
Change the include file from trial_ui.h to trial_cui.h.

2.
From the procedure trial_win_objects_initialize(), remove the creation calls for any item which will be multiply generated. Then remove the creation calls for any settings objects which will have a variable number of choice items. For example, if we will have multiple varb_value items and a varying number of choices in the setting1 settings item.

trial_win_objects *
  trial_win_objects_initialize(ip, owner)
trial_win_objects	*ip;
Xv_opaque	owner;
{
  if (!ip && !(ip = (trial_win_objects *) 
                    calloc(1, sizeof (trial_win_objects))))
    return (trial_win_objects *) NULL;
  if (!ip->win)
    ip->win = trial_win_win_create(ip, owner);
  if (!ip->pan)
    ip->pan = trial_win_pan_create(ip, ip->win);
  if (!ip->button1)
    ip->button1 = trial_win_button1_create(ip, ip->pan);
  if (!ip->setting1)
    ip->setting1 = trial_win_setting1_create(ip, ip->pan);
  if (!ip->varb_value)
    ip->varb_value = trial_win_varb_value_create(ip, ip->pan);
  return ip;
}

might become

trial_win_objects *
  trial_win_objects_initialize(ip, owner)
trial_win_objects	*ip;
Xv_opaque	owner;
{
  if (!ip && !(ip = (trial_win_objects *) 
                    calloc(1, sizeof (trial_win_objects))))
    return (trial_win_objects *) NULL;
  if (!ip->win)
    ip->win = trial_win_win_create(ip, owner);
  if (!ip->pan)
    ip->pan = trial_win_pan_create(ip, ip->win);
  if (!ip->button1)
    ip->button1 = trial_win_button1_create(ip, ip->pan);
  return ip;
}

3.
Edit the creation procedures for the custom text field objects so that the functions will accept an integer argument. This argument should be used in the code in order to correctly place the item on the window. As an example,

Xv_opaque
  trial_win_varb_value_create(ip, owner)
caddr_t	ip;
Xv_opaque owner;
{
        .
                PANEL_VALUE_X, 135,
                PANEL_VALUE_Y, 64,
        .
}

could become:

Xv_opaque
  trial_win_varb_value_create(ip, owner, i)
caddr_t	ip;
Xv_opaque owner;
int i;
{
        .
                PANEL_VALUE_X, 135,
                PANEL_VALUE_Y, 64 + 20 * i,
        .
}

4.
Edit the creation procedures for the custom settings items so that the functions will accept an integer argument. This argument should be used in the code in order to set the number of choices. As an trial,

Xv_opaque
  trial_win_setting1_create(ip, owner)
caddr_t	ip;
Xv_opaque owner;
{
        .
                PANEL_CHOICE_NROWS, 1,
        .
}

would become

Xv_opaque
  trial_win_setting1_create(ip, owner, n)
caddr_t	ip;
Xv_opaque owner;
int n;
{
        .
                PANEL_CHOICE_NROWS, n,
        .
}


next up previous contents
Next: Writing the Panel Handlers Up: Customizing the Window Creation Previous: Customizing trial_ui.h   Contents
root
1998-11-02