Re: NewEra 2.2 - Accelerators on child windows
Posted in 1997
Topics: General Discussion
Ian Lucas wrote: > > Has anyone encountered the problem (found a fix) of using accelerators > on menu buttons on child windows ? > > It appears that the accelerator actually gets operated on in the parent > window (assuming the same CTL-? and ALT-? mappings exist in both). > In fact, if the parent menu option is off and the child is on - no > action at all occurs when the child accelerator is invoked. Similarly, > if the child menu button is off and the parent is on, the child program > may crash (or other strange results) if the accelerator is invoked on > the child. > > We have used the fudge of using the getWindow().getCtrlWithFocuas() > function in the menu handler to assess which window the actual > accelerator is coming from before performing the relevant function on > the window. We also mimic the availability of the menu options in the > parent when control moves to the child window to ensure that all options > are available when required. We then switch control back to the parent > options when a winFocusIn() event is detected on the parent. > > Unfortunately, this winFocusIn is only detected when a 'control' (of > which a menu button is not one) is given focus on the window. This > means that although clicking on the window background appears to give > focus to the window, not until a control (or the TAB button) is accessed > does focus actually move there. Ian, Apart from the strange accelerator key behavior ( which I have never seen before ), it seems that your real problem is knowing exactly which window of a multiple window system has focus. Clicking on the title bar does not send focus events to the newera window - a bug in my view. There are two options to get around this : 1. David C. Harrison and his excellent New Era Windows Toolkit. As far as I know, his dchWindow class will post focus events when the window actually gets focus from Windows. I have however not tested this myself. You can download a trial version of the NEWT library from his website www.dch.co.uk 2. Use a control or main window to maintain a vector of open windows, then use menu options or shortcuts to focus in on your open windows. The downside to this is that users must be trained to only use the shortcut keys to invoke windows e.g. F1 moves to window X, F2 moves to window Y. HTH, Ciaran Kelly -- RTE Donnybrook Dublin 4 Ireland email: kellyci@rte.ie