Re: gtk_label_new_with_mnemonic() and gtk_accel_label_new()



Murray Cumming wrote:

What's the difference between:

a)
GtkLabel* label = gtk_label_new_with_mnemonic("_something");
gtk_label_set_mnemonic_widget(label, entry);

This creates a label with the 's' underlined. The second call says that when alt+s is pressed, the entry widget should be activated.



and
b)
GtkAccelLabel* = gtk_accel_label_new("_something");
gtk_accel_label_set_accel_widget(label, entry);

?

AccelLabels are mainly used in menus. They display a label (like a normal GtkLabel) plus a key combination on the right. The second call here says to watch accelerators on the entry widget. So if you assign ctrl+; to the activate signal of the entry, then that key combination will be displayed in the accel label beside the text "_something" (note that the s is not underlined).

Note that the second call doesn't have anything to do with accelerators on the label itself (activating a label isn't very interesting anyway).

The AccelLabel will watch for changes in the accelerators as well. This is mainly visible when dynamically changing accels.



I'd guess that b) might do acceleration as well as navigation, but I
don't see how the acceleration key combination would be specified.


James.

--
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






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