Re: [Java-gnome-developer] Unable to Activate an hidden Window from a third party library callback
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2010-04-14 03:05:07
|
On Mon, 2010-04-12 at 23:44 +0000, F.L. wrote: > A) I need to popup a list view on a key, list items can be filtered > by typing wildcards in a textview. Easy. Do you know about TreeModelFilter? http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/gtk/TreeModelFilter.html You add an Entry where user types. You write an Entry.Changed handler; there you call TreeModelFilter's refilter(), then in the TreeModelFilter.Visible you check against the current text of the Entry. > B) use arrow key (prefered) or mouse to select history entry, Yup. You'll want TreeSelection's setMode() to SelectionMode.SINGLE http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/gtk/TreeSelection.html#setMode(org.gnome.gtk.SelectionMode) > put it in the clipboard, Easy, Clipboard's setText(), presumably http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/gtk/Clipboard.html [there's a fair bit more complexity available in GtkClipboard we could expose, but no one has needed it yet] http://library.gnome.org/devel/gtk/stable/gtk-Clipboards.html http://www.freedesktop.org/wiki/Specifications/clipboards-spec > hide the window containing the listview That's your business, but Widget's hide(). > C) and try to paste it back in the former active window. huh? Yikes. You're telling another application to do something? That's not going to be easy. > XSendKey ? That'd just be a simulated keystroke one key at a time. That's probably not a good idea. I can see the effect you're going for; within your own application that'd be do-able. But one app telling another app what to do (outside of, say, libnotify or DBus or...) is really sketchy. Heck, only the window manager can really tell other apps what to do, and even then it's only size and visibility. But in any case, the task right now is to keep a journal of clipboard changes and to be able to replay the selected clipboard item back into the clipboard on request. Even if you can't force paste elsewhere, getting the item onto the clipboard will get you most of the way to what you want. AfC Sydney |