Submitted by Anonymous on Thu, 03/27/2003 - 11:20.
Hi, I`m new to X programming and Motif. What I want is to disable some special characters, like `?`, in some windows. I started off writing a function that checks if the input is `?` at which I disable the character by ``.
Then a parse the translation table with #override function()
Then I tested my code, and realized that no key worked. But then again, I had overridden all keyboard events, or what? So I re-wrote the functino so that if the key pressed isn`t `?` it calls XmTextInsert. Now things were rolling, but hey, Return and Backspace don`t work.
What I thought in the beginning is that when I call function() at the event of key pressed, if the key didn`t match some criteria default action would be taken, like Return for example. But apparently this isn`t the case, or am I misunderstanding things?? Sould I rather make function() do nothing at all and call it with eth function() to skip writing code for Return etc.
Can someone give me some tips about a way to do this, i.e. to disable some characters. Hope you understand me ;)
Sat, 03/29/2003 - 09:14#1
ICS_support
keyboard events
It depends on a few things. Are you trying to prevent the > key for all windows or a particular type? Or just for a specific text box (XmText or XmTextField)? If the latter, then you can use the code that`s been published to handle password-entry, which involves some application-side processing; it shows you how to forward text back to the text widget and filter things along the way. See the code from O`Reilly`s Volume 6A, which is on-line (see the News section of this site).
PS are you sure that you`re not going to irritate your users?