tongz@MN.ECN.PURDUE.EDU (Tong Zheng) (07/03/90)
I need help on problems I have when I program using Athena Text Widget and accelerators. The first one is trivial: I am writing a program using Athena Text Widget running with X11R4 on a SUN 4. I creat a text input window using asciiTextWidget with type "string", and like to have the borderwidth changed whenever the cursor moves in/out the window. Because there is no such a default action function in Text Widget, I make my own globe action function to change the borderwidth resource by using XtSetValues. But it does not do anything to the window. Did I use the wrong function here? I tried to apply the same way to other widgets, such as Command(I am using extension sharp style, the highlight() function does not work by default), I got the same result. Strange thing is if I change the background value instead of changing borderwidth, it does work. The second problem is about using accelerator: I have several text widgets created from a form widget. Each text widget is a input window receiving usr input. Whenever usr press Button1 on one of the text window, I like to have this window selected, and all input focus on this window(means the cursor can be anywhere in the form widget, even in other text window, whatever the user types all goes to the window selected). Because user can choose any one of text windows, I do the focus selection in a action function when user press left mouse button. In this action function, I treat the selected window as accelerator source widget, any other text windows and form widget is destination widget. I do XtInstallAllAccelerators(... for the first one selected, it works fine. But when second, third, etc is selected, the focus is still on the first one selected. It seems the accelerators installed by the first one still have effect on rest of the widgets, and in the high priority. I could find any function to release/destroy added accelerators. Any hints and suggestions about this problem? Any help is appreciated!! P.S: Any response can be either sent to me via e-mail or posted on the newgroup. I will put the summary on the newsgroup if there is a such need. --- | Zheng, Tong | major: Computer Science | | - student programmer, Mechanical Eng., Purdue University| | ARPA: tongz@mn.ecn.purdue.edu BITNET: xdpc@puccvm.BITNET| ------------------------------------------------------------ *Ask me who is going to win the World Cup??????????????? *germany, germanY, germaNY, germANY, gerMANY, geRMANY, gERMANY!
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (07/03/90)
> I make my own globe action function > to change the borderwidth resource by using XtSetValues. > But it does not do anything to the window. I suspect that your parent widget is disallowing this geometry change. Many of the Athena Constraint widgets disallow the geometry requests of their children by default. Check the docs for the parent, to see of it supports an "allowResize" or some such constraint resource. As a side note: I have done this sort of thing often, and have found that setting the border color == background is almost always better, it avoids the size of the Text widget changing, and results in less user confusion. Personal preference, but at least consider it. This is what the Athena Text widget's Search dialog does in R4, BTW. > The second problem is about using accelerator: I'll leave this to someone more familiar with accelerators. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213
swick@ATHENA.MIT.EDU (Ralph Swick) (07/03/90)
> The second problem is about using accelerator: Your description isn't really clear enough for me to understand exactly what you're doing, though I think I have gist of it. Perhaps the following will help you: > I do > XtInstallAllAccelerators(... > for the first one selected, it works fine. But when second, > third, etc is selected, the focus is still on the first one > selected. It seems the accelerators installed by the first > one still have effect on rest of the widgets, When an accelerator table is installed on a destination widget, if the events specified in it duplicate events already specified for the destination then one of the two specifications is ignored. The default is to ignore the accelerator and leave the original binding alone ("#augment"; see Section 10.4 of the Xt manual.) > I could find any function to release/destroy added > accelerators. That's correct, there is no such function. You could save the original translations (before installing the accelerators) with XtGetValues and re-install them with XtSetValues if you wanted, but some might call that a hack. -Ralph
rlh2@ukc.ac.uk (Richard Hesketh) (07/03/90)
In article <9007021835.AA06703@mn.ecn.purdue.edu> tongz@MN.ECN.PURDUE.EDU (Tong Zheng) writes: > I am writing a program using Athena Text Widget running >with X11R4 on a SUN 4. I creat a text input window >using asciiTextWidget with type "string", and like to >have the borderwidth changed whenever the cursor moves >in/out the window. The border width is part of the geometry of a widget and as such it is up to the parent's geometry manager to allow any changes made to it. Instead of changing the border width why not change the *border colour*? Changing the border colour between the text widgets background and foreground works for me and looks good. Also changing the border width even with the parents approval will cause the widget to move on the screen a bit.