mark@ks25.UUCP (Mark Johnson) (01/11/91)
We have a large application written using the DECwindows toolkit (v 4.0). The application has a large number of PushButtons many of which have accelerators. Under certain conditions it is necessary that we disable some of these PushButtons. We do this by making the PushButtons insensitive. However, we have found that pressing the accelerator key for an insensitive PushButton still causes the activate callback for that PushButton to be executed. Is this a bug or have we missed something? Is there some way to disable the accelerator? Can we then re-enable the accelerator at a later time? In certain cases we make the PushButton insensitive by means of a resource in a resource file. Can we disable the accelerator via a resource? We would prefer to be able to disable both the PushButton and its associated accelerator with a single resource, but we can deal with multiple resources if necessary. Thank you Mark decwrl!ks25!mark
tp@mccall.com (Terry Poot) (01/16/91)
Disclaimer: I barely know what I'm talking about. I recently attended a seminar where this was mentioned. In article <602@ks25.UUCP>, mark@ks25.UUCP (Mark Johnson) writes: >We have a large application written using the DECwindows toolkit >(v 4.0). The application has a large number of PushButtons many >of which have accelerators. Under certain conditions it is >necessary that we disable some of these PushButtons. We do this >by making the PushButtons insensitive. However, we have found >that pressing the accelerator key for an insensitive PushButton >still causes the activate callback for that PushButton to be >executed. > >Is this a bug or have we missed something? Is there some way to >disable the accelerator? Can we then re-enable the accelerator >at a later time? I think this is the expected behavior. >In certain cases we make the PushButton insensitive by means of a >resource in a resource file. Can we disable the accelerator via a >resource? We would prefer to be able to disable both the >PushButton and its associated accelerator with a single resource, >but we can deal with multiple resources if necessary. I don't think there is a way to remove the accelerators. The standard trick mentioned in the seminar for dealing with this was (I think) for the callback to check to see if the widget is sensitive, and if not, simply do nothing. Granted, it is a hack, but not a difficult one. You could write a little utility routine to get the proper resource and return its value. Then your callback would have code such as: callback_routine(Widget w, ..., ...){ ... if(is_sensitive(w)){ ... do the callback functionality ... } } The reason I'm writing this, being rather unqualified, is to find out if I'm right, since this is a problem I will have in the near future. If I'm wrong, correct me. If I'm right, and you've written such a utility routine, please send it to me. I don't like reinventing even little wheels. :-) -- Terry Poot <tp@mccall.com> The McCall Pattern Company (uucp: ...!rutgers!ksuvax1!mccall!tp) 615 McCall Road (800)255-2762, in KS (913)776-4041 Manhattan, KS 66502, USA