Re: Signals question

On 06/02/2005 10:32:03 AM, Derrick J Houy wrote:
In a simple text editor, I have a "docked" find/replace bar, as apposed to the common dialog version.

The problem I had is that when pressing Ctrl-v inside either the find or the replace entry box, the text is pasted into the editing window instead.

If I create my Edit->Paste menu item without an accelerator, the related function is never called, and all works well--it seems that both the find entry box, and the editor window handle the Ctrl-v implicitly. But, if I do that, selecting the menu item obviously does nothing, and the non-existent accelerator is not displayed for users.

In the end, I overcame the problem by connecting/disconnecting the accelerator for the Edit->Paste menu item when the editor window receives/loses focus. This works, but feels a bit "bubblegum-and-sticky-tape'ish", and I can't help wondering if there is perhaps a better, more robust, way of doing this. My main concern with my current approach is that gtk_action_disconnect_accelerator only disconnects the accelerator if the accel_count has reached 0--and I cannot find a way to tell what accel_count is for a given GtkAction.

I'm not sure whether this is any less "bubblegum-and-sticky-tape'ish", can view your ctrl+V callback as a director. Get the focus-widget for the parent window, and take different actions depending on which widget it is.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]