Path: utzoo!utgpu!watmath!att!dptg!rutgers!cs.utexas.edu!sun-barr!newstop!sun!eureka!argv From: argv%eureka@Sun.COM (Dan Heller) Newsgroups: comp.windows.x Subject: Re: Keyboard focus Message-ID: <119949@sun.Eng.Sun.COM> Date: 8 Aug 89 04:58:13 GMT References: <2749@marble.sw.mcc.com> Sender: news@sun.Eng.Sun.COM Reply-To: argv@sun.UUCP (Dan Heller) Lines: 41 In article <2749@marble.sw.mcc.com> cheung@marble.sw.mcc.com (Po Cheung) writes: > I have a simple program that pops up an asciiString widget for > a user to enter text. The program works ok under twm on a ^^^ > Sun 3. However, when I run the same program on a DECstation 3100 > running Ultrix 2.0 and the DECwindow manager, the popupshell loses ^^^^^^^^^^^^^^^^^ > the keyboard focus, and I cannot enter text at the asciiString widget. I don't know this for sure, but I -suspect- that it's the window manager. The widget needs to get keyboard input focus from the window manager and widgets, by default, do not set keyboard focus. You need to add to your widget in one of various methods, XtNinput to be True. One way is simply for the application to set it: XtSetArg(arg, XtNinput, True); Explanation: ICCCM window managers don't give keyboard focus to windows unless they ask for it. It would seem to "make sense" for a "toolkit" which provides window manager communication to handle this for the programmer. However, the athena toolkit makes no such provisions. You don't have this problem with TWM probably it's not ICCCM compliant (at least in this case and not in the version you're using). twm is allowing the window to have input focus despite the fact that the window didn't ask for it. Soap box: I personally feel that it extends beyond the toolkit and into the domain of the Intrinsics to handle this functionality. It should be part of the intrinsics itself to have smarts about whether or not a widget is intended to get focus. It can easily be coded to check for the existence of a translation table and if the widget in question has a keyboard/mouse type action in the action list. if so, set the input focus automatically -- otherwise, leave it up to the individual widgets to set it accordingly. I feel that since the intrinsics handle all other window manager communi- cations like this, it sets prcedent that the intrinsics should also handle input focus. dan ----- My postings reflect my opinion only -- not the opinion of any company.