b = setfont(ErrMsg ‖ ValueSets ‖ NumberPad ‖ UserBar ‖ Notes ‖ All, font_name, font_sizeʃ, bold, italicsʅ);
b = setfont(ErrMsg ‖ ValueSets ‖ NumberPad UserBar ‖ Notes ‖ All, default);
In a data entry application, the
setfont function allows you to modify the font that CSPro uses to display text in:
- ErrMsg: The font that appears in boxes generated by the errmsg function.
- ValueSets: The font that appears in capture type popup windows (other than the number pad).
- NumberPad: The font that is used by the number pad.
- UserBar: The font that appears in buttons and text strings on the userbar.
- Notes: The font that appears when a user edits a field note.
- All: The font is changed for all of the four above entities.
The font is changed to the font indicated by the string expression font_name and the numeric expression font_size, or if the resetting format is used, the font is restored to CSPro's default font selection. The user must ensure that the desired font is installed on the machine that will run the data entry application. Optional bold and italics markers may be indicated. Calls to this function are ignored when executed on mobile devices.
The function returns 1 (true) if the font(s) were changed successfully, and 0 (false) otherwise.
function majorError(string message)
setfont(ErrMsg, "Arial", 24, bold, italics);
errmsg("%s", message);
end;
function minorError(string message)
setfont(ErrMsg, "Arial", 12, bold);
errmsg("%s", message);
end;
function minorWarning(string message)
setfont(ErrMsg, "Arial", 12, italics);
errmsg("%s", message);
end;
PROC AGE
if AGE > 95 then
minorWarning(maketext("Age (%d) is over 95, set to 95", AGE));
AGE = 95;
elseif not AGE in 12:95 then
minorError(maketext("Age (%d) is invalid for this survey, reenter", AGE));
reenter;
endif;