Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!csus.edu!ucdavis!csusac!unify!openlook!openlook-request Newsgroups: comp.windows.open-look Subject: Re: To what use is the DevGuide Text field event? Message-ID: <46nwtg6@openlook.Unify.Com> Date: 5 Feb 91 19:06:21 GMT Lines: 56 > > My idear was to make a function that checked the date entered by the user > as the user typed it in, so I defined a text field (Data: _______) and an > event routine and this is what DevGuide gave me (my own indentation!): etc... Instead of interposing an event proc, how about telling XView you want your notify proc to be called on every keystroke instead of the default LF, CR, or TAB? Like so: xv_set(mytextitem, PANEL_NOTIFY_LEVEL, PANEL_ALL, 0); And then your notify proc could filter the good/bad input (see below). Frank G. -------------------------------------------------------------------- /* Only allow integers */ Panel_setting input_nproc(item, event) Panel_item item; Event *event; { char ch; if ( event_is_up(event) ) return PANEL_NONE; if ( !isprint(ch = event_action(event)) ) switch(ch) { case '\n': case '\033': case '\r': fprintf(stderr, "You selected [%s]\n", xv_get(item, PANEL_VALUE)); case '\t': return PANEL_NEXT; } else { if ( !isdigit(ch) ) { notice_prompt(myframe, NULL, NOTICE_MESSAGE_STRINGS, "You can only input integers", NULL, NOTICE_BUTTON_YES, "Continue", NULL); return PANEL_NONE; } else return PANEL_INSERT; } return panel_text_notify(item, event); /* Just in case */ }