mleech@bnr.ca (Marcus Leech) (05/17/91)
I'm posting this on someone elses behalf. He needs to be able to do an XtSetInsensitive on a widget AND ALL ITS CHILDREN. Is there a single call that can do it? What's his best solution. -- Marcus Leech, 4Y11 Bell-Northern Research |opinions expressed mleech@bnr.ca P.O. Box 3511, Stn. C |are my own, and not VE3MDL@VE3JF.ON.CAN.NA Ottawa, ON, CAN K1Y 4H7 |necessarily BNRs
jfr@locus.com (Jon Rosen) (05/18/91)
In article <1991May17.165900.23711@bwdls61.bnr.ca> mleech@bnr.ca (Marcus Leech) writes: >He needs to be able to do an XtSetInsensitive on a widget AND ALL ITS > CHILDREN. Is there a single call that can do it? What's his best > solution. That's exactly what XtSetSensitive(w,false) does! To quote: "The XtSetSensitive function first calls XtSetValues on the current widget with an argument list specifying that the sensitive field should be changed to the new value. It then recursively propagates the new value down the managed children tree by calling XtSetValues on each child to set the ancestor_sensitive to the new value if the new values for sensitive and the child's ancestor_sensitive are not the same." The end result is that the widget's sensitive value is set to false (or true) and each child widget's ancestor_sensitive value is set to the same value. According to Xt rules, if EITHER the sensitive or the ancestor_sensitive value are False, the widget is insensitive. They must BOTH be true for the widget to be sensitive. PS - You can explicitly reset the ancestor_sensitive value to true if you want a child widget to accept input even though its parent does not, after calling XtSetSensitive. This works fine (we use it to manage a button in a window that can be used to cancel an action that is long-running and underway without allowing any input on any other widget in the window). Jon Rosen