Scroll to navigation

MatchEditor(3I) InterViews Reference Manual MatchEditor(3I)


MatchEditor - StringEditor with pattern matching


#include <InterViews/matcheditor.h>


MatchEditor is a StringEditor subclass that checks the validity of its contents against a specified pattern. It is suitable for entering strings that must conform to a particular format such as a number or a file name. The matching pattern is specified according to the rules of scanf(3). For example, a pattern of "%3d" will match a 3-digit integer, a pattern of "%[ab]" will match a string containing only a's and b's, and a pattern of "(%f, %f)" will match the string "(12.0, 5E23)".


Create a new MatchEditor object. The ButtonState, sample string, and termination string are passed to the StringEditor constructor.
Specify the pattern to match against. When MatchEditor performs matching, it will highlight any trailing part of the edit string that does not conform to pattern. The user can then correct the string. If keystroke is true, matching will occur on every keystroke; otherwise matching will only occur on the completion of the edit. The initial pattern matches any string, and the initial value of keystroke is true.


MatchEditor uses sscanf internally to check the pattern match. Different versions of sscanf have different scanning capabilities; check with your local version to see what patterns you can use.



7 Dec 1989 InterViews