Path: utzoo!attcan!uunet!mcvax!ukc!harrier.ukc.ac.uk!eagle.ukc.ac.uk!pc From: pc@ukc.ac.uk (R.P.A.Collinson) Newsgroups: comp.windows.x Subject: Deficiency in the translation mechanism Message-ID: <6312@eagle.ukc.ac.uk> Date: 22 Jan 89 15:56:08 GMT Reply-To: pc@ukc.ac.uk (R.P.A.Collinson) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 65 I have begun to write X applications programs recently and have come across what I believe to be a deficiency in the way that event translations are handled. It may be that I am missing something and there is a solution to this, if so then please let me know. Example problem: Create a text data entry area which acts in the exactly the same way as the existing text widget but which only permits one line of data to be entered. All actions which will cause a newline to be entered - or which deal with line oriented functions (e.g. scroll-one-line-down()) should cause the bell to ring on the console. This *should* interwork in the same applications program with `normal' text area widgets. Sample use: a dialog box asking for a filename. Current solution (1): You supply a translation table which binds Return to Bell() rather than Return: newline() This is not good enough to my thinking. It means that the application writer has to second guess the bindings which the user may or may not supply for all these actions. What is *really* needed is the ability to alter the action of newline(). Registering an action table for newline() does not work because this is not widget specific. It alters every newline() action in the program. Registering an action table for newline() and then calling the old newline() code does not work because the old newline code is private. Current solution (2): Write a new widget which replicates most of the code in the text widget. Question: Why should all problems be solved by writing widgets? I do intend to get involved with the full horror of this at some point in the near future but at the moment it seems to a good idea to write applications programs. Eventually I guess we will enter the realm of binary only X libraries and so this solution will not be available to people. Anyway, all I want to do is to be able to selectively replace the actions for a known widget with my own actions. After all a OneLineTextWidget will be forced to copy most of the source from a normal TextWidget which seems a little wasteful. Any help gratefully received. Peter Collinson pc@ukc.ac.uk