RE: How to switch focus to another UI ?
- From: gtk amnesia accessgate com sg
- To: gtk-list gnome org
- Subject: RE: How to switch focus to another UI ?
- Date: Sat, 29 Jul 2006 18:05:56 +0800 (SGT)
On 27-Jul-2006 gtk amnesia accessgate com sg wrote:
> Hi all,
>
> I have a (what seems to me) to be a simple application that I just, for the
> life of me, I cannot get to work.
>
> I have 2 small UI's, both in one application. one UI, is, for example, a
> button
> box. It is unimportant, except that it has widgets that you click. a "click
> callback" is attached to the widgets, and that works just fine.
>
> The 2nd UI is a notebook, with tabs.
>
> Now, when you click widgets in the 1st ui, the callback has several things it
> wants to accomplish.
>
> - it wants to select a particular tab in the notebook, and cause
> that tab to be the selected tab. This was very straight forward
> and worked the 1st time I tried. :)
>
> - it *also* wants the notebook to become the selected UI (instead
> of the UI containing the clickable widgets).
>
> I *know* that this can be done, but for the life of me I'm at a loss how to
> accomplish this.
>
> For the curious I have attached a sample small program with 2 sample UI's.
> clicking a button in the button box, does cause the desired notebook tab to
> be
> selected, but the focus remains on the button box, and does NOT pass off to
> the
> notebook.
>
> Anyone done anything like this before ? anyone know of any sample code to
> look
> at ? (except gaim... it's way too encapsulated to follow :(
In the tradition of answering one's own question, I'm posting the answer, so
that it's available in the archives :)
gtk_window_present() will focus the window
gtk_widget_grab_focus() will set the focus to a particular input
widget (if the window is first focused)
best rgds,
-Greg
+---------------------------------------------------------------------+
Please also check the log file at "/dev/null" for additional information.
(from /var/log/Xorg.setup.log)
| Greg Hosler greg hosler per sg |
+---------------------------------------------------------------------+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]