mysterious beeping article crossposted from hp windows author was andy defaria posted on mon apr gmt for some reason the following code causes my x application to beep whenever i intercept a keystroke and change it s meaning the intent of this code it to allow date fields the following special keys tt insert today s date bump day up by one bump day down by one i hardcoded some dates for this example perhaps i shouldn t be using an xmtext field for this for some reason the following code beeps whenever any of the special keys of tt are hit why the idea of this code is to interpret these keys having the special meaning implied by the code i would like to get rid of the beeping but as far as i can tell i m not doing the beep and am at a lose as to understanding who and why the beeping is occuring include x intrinsic h include xm xm h include xm rowcolumn h include xm mainw h include xm text h widget toplevel widget mainwindow widget mainpane widget datefield xtappcontext application void marktoday widget date char todaysdate xtvasetvalues date xmnvalue todaysdate null marktoday void marktomorrow widget date char tomorrowsdate xtvasetvalues date xmnvalue tomorrowsdate null marktomorrow void markyesterday widget date char yesterdaysdate xtvasetvalues date xmnvalue yesterdaysdate null markyesterday void datekeys widget callingwidget widget date xmtextverifyptr callbackdata capture the keys tt can change their behaviour if found set doit to false so x won t interpret the keystroke switch callbackdata text ptr case t case t marktoday date callbackdata doit false return case case markyesterday date callbackdata doit false return case case marktomorrow date callbackdata doit false return default return switch datekeys void main cardinal argc char argv initialize xt toplevel xtvaappinitialize application application null argc argv null null create the toolface mainwindow xtvacreatemanagedwidget mainwindow xmmainwindowwidgetclass toplevel null create a mainwindow mainpane xtvacreatemanagedwidget mainpane xmrowcolumnwidgetclass mainwindow null create a small text area datefield xtvacreatemanagedwidget datefield xmtextwidgetclass mainpane xmntopattachment xmattach form xmnrightattachment xmattach form xmncolumns null set modifyverifycallback to the datekeys callback xtaddcallback datefield xmnmodifyverifycallback xtcallbackproc datekeys xtpointer datefield realize the toplevel xtrealizewidget toplevel go into the xtmainloop xtappmainloop application main i swear by my life and the love of it that i will andrew defaria never live for the sake of another man nor ask hewlett packard another man to live for mine california language labs john galt defaria cup hp com i swear by my life and the love of it that i will andrew defaria never live for the sake of another man nor ask hewlett packard another man to live for mine california language labs john galt defaria cup hp com
