Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!mintaka!bloom-beacon!dont-send-mail-to-path-lines From: fgreco@govt.shearson.COM (Frank Greco) Newsgroups: comp.windows.x Subject: Re: XView Panel Text Item thoughts Message-ID: <9102281557.AA09516@fis1.shearson.com> Date: 28 Feb 91 15:57:06 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 60 > > Problems surfaced, however, when I needed to *translate* the keystroke > event into something else - in my case, coerce lower-case to upper-case. > No amount of fiddling with the passed event structure results in a > modification of the character actually inserted into the text item. I > suspected that the panel code is not re-examining the event structure > upon return of the notify procedure. If you do all your handling in the event proc, it's easy and it works just fine. Just connect the following to your text item's event procedure: --------------------------------------------------------------------- void input_eproc(item, event) /* item's event proc */ Panel_item item; Event *event; { char ch; if ( event_is_up(event) ) return; 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; } else { if ( isalpha(ch) ) event_id(event) = TOUPPER(ch); /* force it upwards */ else { notice_prompt(numstring_window1->window1, NULL, NOTICE_MESSAGE_STRINGS, "You can only input characters", NULL, NOTICE_BUTTON_YES, "Continue", NULL); return; } } panel_default_handle_event(item, event); } --------------------------------------------------------------------- > Would it not be more generally useful to allow arbitrary event translation > by the notification procedure? Sure, you have to know what you're doing, > but I'd argue that anyone attempting this sort of low-level event > processing probably does. That's what XView event procs are for. Frank G.