mnemonic labels (was Re: Remove spaces in dialog window)




On Aug 4, 2005, at 12:59 AM, Beast wrote:

Whats the usefullness of using new_with_mnemonic in Label, since afaik Gtk2::Label is readonly widget.

You can set the label to be the mnemonic for another widget.

   # new() is aliased to new_with_mnemonic() in the perl bindings:
   $label = Gtk2::Label->new ('_User Name');
   $entry = Gtk2::Entry->new;
   # set $label to be the mnemonic for $entry
   $label->set_mnemonic_for ($entry);
   $hbox = Gtk2::HBox->new;
   $hbox->pack_start ($label, FALSE, FALSE, 0);
   $hbox->pack_start ($entry, TRUE, TRUE, 0);

This sets things up so that when the user activates the mnemonic Alt +u (in $entry), the keyboard focus goes to $entry.

gtk_button_new_with_mnemonic() and the like essentially do this for you. For separate widgets, you have to do it by hand.



--
I bring the rock, and provided it is fiscally responsible, I will bring the funk as well. And that's fo-shizzle.
    -- Saturday Night Live




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