vendredi 29 avril 2011

How to change the caption of a form according to the caller form

You can do that in the method active of your dataSource
public int active()
{
    boolean         canEdit = true;
    ;
    ret = super();

    element.design().caption(element.buildCaptionTextForActive());

    return ret;
}

Add this method to your form

str buildCaptionTextForActive()
{
    str activeLabel;
    ;

        // Build the string with details of the current category to use as label on the form caption
   if( ThyProjForcasTable.ProjCategoryType == ThyProjforecast::Hour)
   {
        activeLabel = strfmt("%1 - %2: %3, %5","@SYS53037","@SYS82923",ThyProjForcasTable.ProjForecastModelId,
                             "@SYS10223",ThyProjForcasTable.ProjId);
   }
   else if ( ThyProjForcasTable.ProjCategoryType == ThyProjforecast::Cost)
   {
        activeLabel = strfmt("%1 - %2: %3, %5","@SYS78785","@SYS82923",ThyProjForcasTable.ProjForecastModelId,
                             "@SYS10223",ThyProjForcasTable.ProjId);
   }
   else
   {
        activeLabel = strfmt("%1 - %2: %3, %5","@SYS119188","@SYS82923",ThyProjForcasTable.ProjForecastModelId,
                             "@SYS10223",ThyProjForcasTable.ProjId);
   }
   return activeLabel;
}

Aucun commentaire:

Enregistrer un commentaire