mikel@ritcsh.csh.rit.edu (Mike Leibow) (02/23/91)
Hi, I have a sun3/60 with 12M of ram, sunOS 4.0.3. I am using the mit sample server X11R4 with all 18 patches. I am using Motif V1.0 with the Motif intrinsics. cb[0].callback = (XtCallbackProc)callback; cb[0].closure = (caddr_t)client_data; cb[1].callback = (XtCallbackProc)NULL; cb[1].closure = (caddr_t)NULL; XtSetArg(al[ac],XmNactivateCallback,cb); ac++; text=XtCreateManagedWidget("text", xmTextWidgetClass,rc,al,ac); This widget never calls its activateCallback. If I override the translation list with <Btn2Down>: activate()\n\ <Key>: self-insert()\n\ <FocusIn>: focusIn()\n\ <FocusOut>: focusOut()\n then mouse button 2 will cause an activateCallback. However, the default translations and the <Key>:Return don't do it. Also, if I explicitly add <Key>:Return: activate(), that doesn't work either. Thanks for your help... --Mike Leibow
nick@esacs.UUCP (Nikolaos Tsivranidis) (03/07/91)
In article <1991Feb22.195012.1357@ritcsh.csh.rit.edu> mikel@ritcsh.csh.rit.edu (Mike Leibow) writes: >translations and the <Key>:Return don't do it. Also, if I explicitly >add <Key>:Return: activate(), that doesn't work either. I find the whole situation of "When does the activateCallback get called" even more confusing. Hope someone can help! Not only does the <Key>:Return: activate() not work, but even if it did, so what? Would the user have to hit a Return to activate the value and then TAB to get out of the field? Try telling *that* to a real user!!! Currently, we use the losingFocusCallback, and basically check the value of the field there. I don't like this approach and I would rather not do it, but is there a better way? Of course I would prefer if Motif would call the activateCallback a bit more inteligently! As far as I can tell, there is no info in the Motif Style Guide, to answer the following question: When does a Text Field validate its input? (Sorry, if the answer is when the user hits Return, I think it isn't good enough). Here is OpenLook's answer to the same question: (OPEN LOOK GUI Application Style Guidelines, pp. 230) Dimmed Change Bars o When you restrict input to a set of legal values, you need to validate the input once users have finished entering it. o You can show unvalidated input by displaying a dimmed change bar. o Display the dimmed change bar as soon as users type a character. ... ... The way I read this, is that text is validated upon exiting, and that the first-char-entered puts the field in a "Changed" state, which is indicated to the user by a "dimmed change bar". I don't know if the OL toolkits implement it this way, but even if they don't, at least one knows how things are supposed to be in the ideal world :-):-) Does anybody know what the appropriate behavior is in Motif??? And now that I am at it, let me ask another question related to Text input validation (this time I couldn't find an answer in either OL or Motif): Suppose I have a Text field that displays the range of ages, something like 1-18, 19-25, 26-50, etc. Suppose that if the age is 1-18, I want to display in a radiobox next to the text some choices, like BICYCLE, BOOK, TOYS etc (gifts for that age group). If the age is 19-25, I may want to display CAR, BOOKS, TRIP-TO-FLORIDA etc. In the above case, if the text field displays 1-18, and the user starts typing something new, I cannot validate the input until the losingFocusCallback. But if she types 19-25, and then hits the TOYS choice on the Radio, I have a bad situation in my hands: A *single* user action has changed 2 values (the text *and* the radio), and moreover these 2 values contradict each other. In this case, the losingFocusCallback of the text field would change the RadioBox, and the selection of the third item would cause my poor 20-year-old to go to Florida :-(:-( We don't want a 20-year old in Florida instead of studying, do we? One way to avoid this situation is to *disable* all related choices, once the user starts typing into a text field. We are currently leaning in this direction, but I would like to hear first if the StyleGuides have anything to say about this. - nick -
marbru@attc.UUCP (Martin Brunecky) (03/09/91)
In article <129@esacs.UUCP> nick@esacs.UUCP (Nikolaos Tsivranidis(JANE)) writes: >In article <1991Feb22.195012.1357@ritcsh.csh.rit.edu> mikel@ritcsh.csh.rit.edu (Mike Leibow) writes: > > Suppose I have a Text field that displays the range of ages, > something like 1-18, 19-25, 26-50, etc. Suppose that if the >.... > and the user starts typing something new, I cannot validate the > input until the losingFocusCallback. Learn about XmNmodifyVerifyCallback. Then learn about the related memory leaks -). -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky {...}sunpeaks!auto-trol!marbru (303) 252-2499 (sometimes also: marbru@auto-trol.COM ) Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404