razdan@chanakya.oakhill.uucp (Anshuman Razdan) (07/11/90)
Hi, I have a interesting situation to which I cannot seem to find an answer. Although I am using the HP widgets, this seems to do more with toolkit actions rather than belonging to a widget set. Anyways, I have an application that has a text widget (permanent) for user I/O and keyboard input. The text widget occupies a small area of the application and is in the bottom 2/5th of the application as shown in the figure _________________________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _________________________________________ | | | Text I/O | | | _________________________________________ To make it easier on the users, I use XtKeyBoardFocus for the topmost widget (and therefore all the otherewidgets to text widget) so that no matter where the cursor is, the keyboard input willgo to the Text widget. So far so good. It works. Now what I want to do is add actions to various functionalities of the application. So in the defaults file I say mpost*TExttWidget.translations: <Key>F1 : Zoomin() where TexttWidget is the name of the text widget. I use XtAddActions to register thezoomin action with toolkit. Now the problem : When I use translations in defaults file it overwrites(or seems to override)the default translations that are in the text widget. Therefore resulting in that I cannot type in any letter in the text widget, with or without keyboard focus on. If I comment out the line in the defaults file every thing seems to be fine. Is there a way that both translations can live side by side. In other words augment the translations. Or is there another way to achieve the same thing. Please email me the pointers or hints or if your extremely kind to the solution or possible solution. Thanks in advance. -- Anshuman Razdan Motorola Sector CAD Internal: razdan@chanakya Austin Tx Internet: razdan@chanakya.sps.mot.com ****************************************************************** * * * PS: All opinions are my own and my employers have their own * * which of course, most probably, in all honesty, as far * * as I know, which sure is a guess, do not coincide with mine. * * * ******************************************************************
jeff@aspect.UUCP (Jeff Rosler) (07/17/90)
I tried to email this directly, but it bounced, so here it is. >... > > mpost*TExttWidget.translations: <Key>F1 : Zoomin() > where TexttWidget is the name of the text widget. I use XtAddActions to >register thezoomin action with toolkit. >Now the problem : When I use translations in defaults file it overwrites(or >seems to override)the default translations that are in the text widget. >Therefore resulting in that I cannot type in any letter in the text widget, >with or without keyboard focus on. If I comment out the line in the defaults >file every thing seems to be fine. Is there a way that both translations >can live side by side. In other words augment the translations. Or is there another >way to achieve the same thing. Well, the translations resource is specified in the Core widget class, so I would say this problem can happen in multiple widget toolkits (at least those that are X Intrinsics based). Your problem is that you did not specify a directive in the translation table. If no directive is specified #replace is used. This replaces your translation table with the default one. You probably want to use #override. This tells the widget to merge the new translations into the current translation table and replace any old values where there is a conflict. So, you might change your specification from > mpost*TExttWidget.translations: <Key>F1 : Zoomin() to mpost*TExttWidget.translations: #override\ <Key>F1 : Zoomin() This should clear up your problem. Translations are explained in detail in "X Toolkit Intrinsics Programming Manual". This is Volume 4 of the O'Reilly & Associates X Window series (ISBN 0-937175-34-X). I highly recommend this book as well as the entire series. Have fun! Jeff Rosler Aspect Telecommunications 1730 Fox Drive San Jose, CA 95131-2312 uunet!aspect!jeff (408) 441-2420