Re: Activate a component

On Thu, Jun 16, 2005 at 01:53:15PM +0200, Jean Chapelle wrote:
> I've some component in my application ; like a GtkTextEntry, a GtkTextView,...
> When I click with my mouse on a component, this component is "activated" and I see the cursor in it. I want to "activate" one of these components by a key combination. I don't know the commands to "activate" a component. Someone can help me???

The usual way is to associate it with a label with mnemonic.
User can press Alt-key to switch to it then (Alt-B here):

    label = gtk_label_new_with_mnemonic("_Blah");
    gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget);

It is possible to use some arbitrary keystroke too by adding
an accelerator (see GtkAccelGroup docs) and calling
gtk_widget_grab_focus(widget) on the target widget when it's
activated (mnemonic activation does gtk_widget_grab_focus()
only sometimes in fact, but it does it in the cases you are
interesed in).


A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

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